This Python generator builds a single-page website from documents. I wrote it for my previous open-source website, with three versions of the output:
You can view a saved sample or save it with your browser's “Save as” option. Its links to baldy.ga no longer work.
Data URIs embed data directly in HTML, CSS or JavaScript rather than linking to a separate file. The downloadable version uses them to include resources such as images within the HTML file. Data can be Base64-encoded or represented as URL-encoded text.
Embedding everything has trade-offs. HTTP/2 multiplexes requests over a TCP connection; HTTP/3 multiplexes streams over QUIC, which runs over UDP. Both can fetch separate resources concurrently. A single large HTML download does not take advantage of separate resource requests or caching for the embedded files.
The benefit is portability: the saved file retains its embedded content even if the original site disappears. It is a snapshot of that content, not an archive of every external resource or linked page.
The generator accepts OpenDocument text files (.odt), so I could write pages in LibreOffice with spell check and other editing tools.
I chose OpenDocument because it is an open standard supported by tools including LibreOffice and Microsoft Office. This kept the source documents separate from the website's implementation without depending on a single editor.
The generator also accepts HTML/HTM and plain text files, offering alternative input formats and more direct control over the output.
After generating a page, the script can submit its HTML to the W3C Nu HTML Checker and display the returned information, warnings and errors.
These messages help identify markup problems in the generator or its source content before publication. They do not check every aspect of the site's behaviour or accessibility.
The OpenDocument parser has limited support for links and more elaborate features, including lists and embedded images.