Output folder instead of .output + now build.py pass the build dir var to html_generator.py + new README with link to the wiki

This commit is contained in:
2025-08-10 09:29:56 +00:00
parent d0fe57fe9c
commit e4a9c57b31
4 changed files with 18 additions and 177 deletions

7
.gitignore vendored
View File

@ -1,3 +1,4 @@
.venv .*
.output !.gitignore
__pycache__ output/
__pycache__/

169
README.MD
View File

@ -3,13 +3,13 @@
<img src="https://git.djeex.fr/Djeex/lumeex/raw/branch/main/illustration/lumeex.png" alt="Lumeex Screenshot"> <img src="https://git.djeex.fr/Djeex/lumeex/raw/branch/main/illustration/lumeex.png" alt="Lumeex Screenshot">
</div> </div>
**Lumeex** - Yet another minimalist photo gallery with a static site generator. **Lumeex** - Yet another minimalist very light photo gallery with a static site generator.
Lumeex is a static site generator that builds a minimalist photo gallery. The project was born from the need to create a gallery focused more on the artworks than the author, while allowing users to organize works using tags and share filtered views. In this spirit, each page load displays the photos in random order, allowing users to discover new content they might not have seen before. Lumeex is a static site generator that builds a minimalist photo gallery. The project was born from the need to create a gallery focused more on the artworks than the author, while allowing users to organize works using tags and share filtered views. In this spirit, each page load displays the photos in random order, allowing users to discover new content they might not have seen before.
The project comes with two themes: one modern, the other more minimalistic, both designed to keep the focus on the artworks: The project comes with two themes: one modern, the other more minimalistic, both designed to keep the focus on the artworks:
- Modern 👉 [demo](https://modern.djeex.fr) - Modern 👉 [check the demo](https://modern.djeex.fr)
- Typewriter 👉 [demo](https://typewriter.djeex.fr) - Typewriter 👉 [check the demo](https://typewriter.djeex.fr)
> [!NOTE] > [!NOTE]
> _This GitHub repository is a mirror of https://git.djeex.fr/Djeex/lumeex. Youll find the complete package, history, and release notes there. An LLM is used for bug checking._ > _This GitHub repository is a mirror of https://git.djeex.fr/Djeex/lumeex. Youll find the complete package, history, and release notes there. An LLM is used for bug checking._
@ -19,7 +19,6 @@ The project comes with two themes: one modern, the other more minimalistic, both
- [Features](#features) - [Features](#features)
- [Python Installation](#python-installation) - [Python Installation](#python-installation)
- [Configuration](#configuration) - [Configuration](#configuration)
- [Build the Site](#build-the-site)
## Features ## Features
@ -71,164 +70,4 @@ You're ready to go!
## Configuration ## Configuration
All user configuration files are located in the `config` folder. For detailed documentation about configuration options, customization and demo, visit https://lumeex.djeex.fr
```sh
Lumeex/
└── config/
├── photos/
│ ├── gallery
│ └── hero
├── themes/
│ ├── modern
│ └── typewriter
├── gallery.yaml
└── site.yaml
```
**`photos/`**
- `gallery/`: place your gallery photos here.
- `hero/`: place carousel photos for the homepage here.
> [!TIP]
> You can use `gallery.py` to automatically reference all photos in `gallery/` and `hero/` into `gallery.yaml` and `site.yaml` by running `python3 gallery.py` from the `lumeex` directory.
> Youll just need to tag the photos in `gallery.yaml`.
**`site.yaml`**
This file contains all your sites metadata and settings. For example:
```yaml
info:
title: your title
subtitle: your subtitle
description: your description
canonical: all, your, keywords
author: you
google_analytics_id: G-XXXXXXX # optional
social:
instagram_url: https://www.instagram.com/yourprofile
thumbnail: gallery/anyphoto.png # put the path from your photo folder to your file
menu:
items:
- label: your_home
href: /
- label: your_second_menu
href: /?tag=yourtag1
- label: Your_third_menu
href: /?tag=yourtag2
hero:
images:
- src: hero/your_photo_1.jpg
- src: hero/your_photo_2.jpg
- src: hero/your_photo_3.jpg
footer:
copyright: Copyright © 2025 You
legal_link: '/legals.html'
legal_label: Legal notice
build:
theme: modern
convert_images: false
resize_images: false
legals:
hoster_name: Your_hoster
hoster_adress: Your hoster address
hoster_contact: Your hoster contact
intellectual_property:
- paragraph: "Your text here"
- paragraph: "Your second paragraph here"
- paragraph: "Etc..."
```
**`gallery.yaml`**
Use this file to reference the images in `photos/gallery/`. You can do this manually or automatically by running `python3 gallery.py`. You can also assign tags to the photos here.
```yaml
images:
- src: gallery/your_photo_1.jpg
tags: ["portrait"]
- src: gallery/your_photo_2.jpg
tags: ["portrait", "sunset", "boat"]
- src: gallery/your_photo_3.jpg
tags: ["landscape", "sea", "beach", "sand"]
```
**`themes/`**
```sh
themes/
└── yourtheme/
├── fonts (optional)
├── theme.yaml
├── theme.css (optional)
└── favicon.png
```
**Lumeex** is shipped with two prebuilt themes:
- Modern 👉 [demo](https://modern.djeex.fr)
- Typewriter 👉 [demo](https://typewriter.djeex.fr)
You can edit existing themes or create your own. Each theme can include:
- **Required:** a `theme.yaml` file for visual settings (colors, fonts, etc.)
- *(Optional)* a `theme.css` file for additional styling
- *(Optional)* a `fonts` folder for local fonts
- *(Optional)* a square `favicon.png` (min 196px) that will be automatically converted to all required formats.
Example `theme.yaml`:
```yaml
colors:
primary: '#0065a1'
primary_dark: '#005384'
secondary: '#00b0f0'
accent: '#ffc700'
text_dark: '#333'
background: '#fff'
browser_color: '#fff'
favicon:
path: favicon.png
google_fonts:
- family: Lato
weights:
- '200'
- '400'
- '700'
- family: Montserrat
weights:
- '200'
- '400'
- '700'
fonts:
primary:
name: Lato
fallback: sans-serif
secondary:
name: Montserrat
fallback: serif
```
## Build the Site
Once everything is configured, make sure you're in the `lumeex` directory and your Python virtual environment is activated (`source .venv/bin/activate`).
- *(Optional)* Run `python3 gallery.py` to auto-fill `gallery.yaml` and add carousel photos to `site.yaml`. Don't forget to add tags to your photos in `gallery.yaml`.
- Run `python3 build.py` to generate the static site.
- *(Optional)* Serve locally with:
```sh
python3 -m http.server 3000 --directory .output
```
Then visit `http://localhost:3000` or, if remote, `http://your-server-ip:3000`.
> [!WARNING]
> Use this only to test your site. Don't use python server for production !
- Finally, copy the contents of the `.output/` directory to your favorite web server.

View File

@ -13,7 +13,7 @@ logging.basicConfig(level=logging.INFO, format='%(message)s')
# Define key directories used throughout the script # Define key directories used throughout the script
SRC_DIR = Path.cwd() SRC_DIR = Path.cwd()
BUILD_DIR = SRC_DIR / ".output" BUILD_DIR = SRC_DIR / "output"
TEMPLATE_DIR = SRC_DIR / "src/templates" TEMPLATE_DIR = SRC_DIR / "src/templates"
IMG_DIR = SRC_DIR / "config/photos" IMG_DIR = SRC_DIR / "config/photos"
JS_DIR = SRC_DIR / "src/public/js" JS_DIR = SRC_DIR / "src/public/js"
@ -166,7 +166,7 @@ def build():
# Hero carrousel generator # Hero carrousel generator
if hero_images: if hero_images:
generate_gallery_json_from_images(hero_images, BUILD_DIR / "data" / "gallery.json") generate_gallery_json_from_images(hero_images, BUILD_DIR)
else: else:
logging.warning("[~] No hero images found, skipping JSON generation.") logging.warning("[~] No hero images found, skipping JSON generation.")
@ -175,8 +175,8 @@ def build():
canonical_url = site_info.get("canonical", "").rstrip("/") canonical_url = site_info.get("canonical", "").rstrip("/")
if canonical_url: if canonical_url:
allowed_pages = ["/", "/legals/"] allowed_pages = ["/", "/legals/"]
generate_robots_txt(canonical_url, allowed_pages) generate_robots_txt(canonical_url, allowed_pages, BUILD_DIR)
generate_sitemap_xml(canonical_url, allowed_pages) generate_sitemap_xml(canonical_url, allowed_pages, BUILD_DIR)
else: else:
logging.warning("[~] No canonical URL found in site.yaml info section, skipping robots.txt and sitemap.xml generation.") logging.warning("[~] No canonical URL found in site.yaml info section, skipping robots.txt and sitemap.xml generation.")

View File

@ -23,9 +23,10 @@ def render_gallery_images(images):
""" """
return html return html
def generate_gallery_json_from_images(images, output_path): def generate_gallery_json_from_images(images, output_dir):
try: try:
img_list = [img["src"] for img in images] img_list = [img["src"] for img in images]
output_path = output_dir / "data" / "gallery.json"
output_path.parent.mkdir(parents=True, exist_ok=True) output_path.parent.mkdir(parents=True, exist_ok=True)
with open(output_path, "w", encoding="utf-8") as f: with open(output_path, "w", encoding="utf-8") as f:
json.dump(img_list, f, indent=2) json.dump(img_list, f, indent=2)
@ -33,7 +34,7 @@ def generate_gallery_json_from_images(images, output_path):
except Exception as e: except Exception as e:
logging.error(f"[✗] Error generating gallery JSON: {e}") logging.error(f"[✗] Error generating gallery JSON: {e}")
def generate_robots_txt(canonical_url, allowed_paths): def generate_robots_txt(canonical_url, allowed_paths, output_dir):
robots_lines = ["User-agent: *"] robots_lines = ["User-agent: *"]
for path in allowed_paths: for path in allowed_paths:
robots_lines.append(f"Allow: {path}") robots_lines.append(f"Allow: {path}")
@ -41,12 +42,12 @@ def generate_robots_txt(canonical_url, allowed_paths):
robots_lines.append("") robots_lines.append("")
robots_lines.append(f"Sitemap: {canonical_url}/sitemap.xml") robots_lines.append(f"Sitemap: {canonical_url}/sitemap.xml")
content = "\n".join(robots_lines) content = "\n".join(robots_lines)
output_path = Path(".output/robots.txt") output_path = output_dir / "robots.txt"
with open(output_path, "w", encoding="utf-8") as f: with open(output_path, "w", encoding="utf-8") as f:
f.write(content) f.write(content)
logging.info(f"[✓] robots.txt generated at {output_path}") logging.info(f"[✓] robots.txt generated at {output_path}")
def generate_sitemap_xml(canonical_url, allowed_paths): def generate_sitemap_xml(canonical_url, allowed_paths, output_dir):
urlset_start = '<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n' urlset_start = '<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'
urlset_end = '</urlset>\n' urlset_end = '</urlset>\n'
urls = "" urls = ""
@ -54,7 +55,7 @@ def generate_sitemap_xml(canonical_url, allowed_paths):
loc = canonical_url.rstrip("/") + path loc = canonical_url.rstrip("/") + path
urls += f" <url>\n <loc>{loc}</loc>\n </url>\n" urls += f" <url>\n <loc>{loc}</loc>\n </url>\n"
sitemap_content = urlset_start + urls + urlset_end sitemap_content = urlset_start + urls + urlset_end
output_path = Path(".output/sitemap.xml") output_path = output_dir / "sitemap.xml"
with open(output_path, "w", encoding="utf-8") as f: with open(output_path, "w", encoding="utf-8") as f:
f.write(sitemap_content) f.write(sitemap_content)
logging.info(f"[✓] sitemap.xml generated at {output_path}") logging.info(f"[✓] sitemap.xml generated at {output_path}")