Re-engineering Full Frontal Nudity Attack: A Static Site Overhaul
Project Overview
The original Full Frontal Nudity Attack website was built using a combination of disparate scripts and manual HTML edits, leading to significant challenges in maintainability, scalability, and consistency. This re-engineering project aimed to centralize and automate the entire site generation process, creating a modern, efficient, and easily updatable static website.
The Challenge: Fragmentation & Inefficiency
Initially, the site's content was generated through separate processes: * Blog: A basic Python script using string formatting for individual posts and the index page. * Knowledge Base: Utilized MkDocs, built via a separate bash command. * Projects & Main Site: Largely manual HTML.
This fragmented approach led to:
* Duplicated Effort: Maintaining consistent headers, footers, and navigation across different sections was tedious.
* MemoryError
: As content grew, the manual string concatenation in the Python script led to Python MemoryError
issues during the build process, halting site generation.
* Inconsistent Styling: Achieving a uniform look and feel across all sections was difficult due to disparate generation methods and relative CSS paths.
* Slow Development Cycle: Any new page type or site-wide change required significant manual intervention.
The Solution: A Unified Python-Jinja2 Pipeline
The core of the re-engineering involved creating a single, comprehensive Python script (build_site.py
) leveraging the Jinja2 templating engine.
Key aspects of the solution include:
-
Jinja2 Template Inheritance: A
base.html
template now defines the site's entire boilerplate (head, header, footer, main content area). All other pages (index.html
,blog_post.html
,blog_index.html
,project_single.html
,projects_index.html
) extend thisbase.html
, ensuring site-wide consistency and drastically simplifying design changes. -
Automated Markdown Processing: Python's
frontmatter
andmarkdown
libraries parse content files (Markdown files for blog posts and project entries) into structured data and HTML. This allows for content to be written in an easy-to-use Markdown format, with metadata defined via YAML front matter. -
Dynamic Content Generation: The
build_site.py
script now:- Iterates through Markdown files for both blog posts and project entries.
- Parses their front matter (including custom date formats like "DDMONYYYY").
- Generates individual HTML pages for each post/entry.
- Builds index/listing pages for the Blog and Projects sections, dynamically including summaries and links.
- Injects the latest blog posts and featured projects onto the main
index.html
page.
-
Integrated MkDocs Build: The
build_site.py
orchestrates the MkDocs build process for the Knowledge Base using Python'ssubprocess
module, ensuring it's part of the single, unified build command. -
Robust Navigation & Styling:
- All internal links and asset references (CSS, images) now use absolute paths (e.g.,
/styles.css
,/images/
) to prevent broken links regardless of page depth. - A single
styles.css
file manages the entire site's look, applied consistently viabase.html
. - Unified button styling was implemented across all dynamic content sections.
- All internal links and asset references (CSS, images) now use absolute paths (e.g.,
Technologies Used
- Python 3: The core scripting language for automation.
- Jinja2: Powerful and efficient templating engine.
python-frontmatter
: For parsing YAML front matter in Markdown files.markdown
: For converting Markdown content to HTML.- MkDocs: For the Knowledge Base, integrated into the build pipeline.
- CSS3 & HTML5: For styling and page structure.
Outcomes & Future Prospects
The re-engineering has resulted in a highly efficient and easily manageable static website. New content can be added simply by writing Markdown files, and a single command rebuilds the entire site. The site now boasts a consistent visual identity and improved navigation.
This project serves as a foundational step for further content expansion and feature additions, knowing that the underlying build process is robust and scalable.