9f0a216c5e4639f1bd0d3deffd5e26f51d9cf065
- Created index.html template for the homepage with service cards and partner logos. - Added page_from_md.html template for rendering pages from markdown. - Developed services.html template detailing various services offered. - Implemented tests for link handling in markdown, ensuring external links open in new tabs and internal links function correctly. - Enhanced markdown parser tests to validate heading extraction, content rendering, and link safety. - Introduced utility tests for template rendering, HTML minification, and JavaScript minification. Co-authored-by: Copilot <copilot@github.com>
allucanget.biz website version 5
This repository contains the source for the allucanget.biz website version 5.
The current build workflow is driven by main.py, which renders Jinja2 templates located in the templates/ folder and writes minified HTML output to the html/ directory.
Current build workflow (what main.py does)
- Loads configuration constants at the top of
main.py:TEMPLATE_DIR = 'templates'OUTPUT_DIR = 'html'NAVandPAGESdictionaries that describe navigation and per-page metadata from json files located indocs/.
- Uses Jinja2
Environment(loader=FileSystemLoader(TEMPLATE_DIR))to render templates. - For each template file (all
.htmlfiles intemplates/that do not start with_):- If the template file has an entry in
PAGES, it uses that page'spage_title,page_subtitle,page_cta,page_cta_url, andmetavalues to populate the Jinja context. - It sets the
activeflag in theNAVstructure so templates can render an active navigation item. - Renders the template with the navigation and page context.
- Runs a
minify_htmlfunction on the rendered HTML to remove comments and extra whitespace. - Writes the resulting HTML to
html/<template_name>.
- If the template file has an entry in
- After rendering all pages,
main.pywill attempt to minify CSS and JS in the generatedhtml/cssandhtml/jsfolders usingcss_minifier()andjs_minifier(), which rely on simple regex-based minifiers (minify_cssandminify_js).
Where to find things
- Templates:
templates/(files likeindex.html,services.html, etc.) - Generated output:
html/(created bymain.py) - Source Markdown content (converted in this project):
docs/en/*.md(there areindex.md,services.md,coaching.mdalready) - Assets:
html/css/,html/js/,html/img/(expected to be copied/available for the site)
How to run
-
Create a Python virtual environment and install dependencies. At minimum you need
jinja2. If you plan to add Markdown rendering, also install a Markdown library such asmarkdownormarkdown2. -
Run the build script:
python main.py -
The script will generate rendered HTML files under
html/and attempt to minify CSS/JS inhtml/cssandhtml/js.
Notes & caveats
- The minifiers are simple regex-based helpers. They work for basic minification but are not a full replacement for production-grade tools (e.g., cssnano, terser, html-minifier). Use with caution.
main.pycurrently renders Jinja templates and does not yet treatdocs/en/*.mdas first-class content sources. Thedocs/enmarkdown files were added to start migrating content to Markdown, butmain.pyneeds to be extended to load and render those Markdown files automatically (seeTODO.mdfor a planned approach).- The script expects
templates/files that may include Jinja blocks, partials (files starting with_), and assets referenced by relative paths. Make sure asset paths are present in the output directory or copied during your deploy process.
Contact
For questions about this build flow or to request changes, update TODO.md with the requested enhancements or open an issue in the project.
Description
Languages
HTML
68.9%
Python
24.8%
CSS
6.3%