6 ms·
Show HN: A static site generator that prettifies the output HTML
I recently stripped out Django from my personal site and converted it to a static site, using `staticjinja`.
I found myself writing a lot of custom code to get my site going because I wanted to use Jinja templating inside Markdown.
Once I was done, I decided to strip out `staticjinja` in favour of my own site generator.
And so Jinjabread was born!
- derryman 3y ago[dead]
- rigid 3y agoThere's a gazillion nice python SSGs but when it comes to advanced stuff like responsive imagrs, i18n or js optimization, you always have to add it yourself. It seems most of these never became fit for use for some bigger website.
- SkyMarshal 3y agoFacebook's SSG Docusaurus does those things: https://docusaurus.io/ https://docusaurus.io/ Though you may have to use a plugin for responsive images: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-ideal-image https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-id... I've been using it for a static docs and blog site and it seems to be one of the most mature and comprehensive static site generators available.
- Seb-C 3y agoThat does not sound like a good idea to prettify code where whitespaces are significant and can make or break your layout. How do you deal with it?
- Solvency 3y agoCan anyone please explain what happened to the idea of making static sites the old fashioned way? Pure HTML, CSS, and vanilla JS. And a few files organized in a few folders. And upload. Why must even a static site in 2024 require Python, libraries, framework dependencies, build steps, etc?
- Seb-C 3y agoBecause even in 2024 there is still the unavoidable need not to repeat huge chunks of code such as the page layout, menus, headers and metadata in every single page of the website. And because even in 2024, good SEO requires that the content be directly in the HTML source, even without JavaScript. Also there is no such "old fashioned way". The old fashioned way was to use frames, server side includes with Apache (before PHP became popular), or have WYSIWYG tools do it for you.
- Solvency 3y agoI'm referring to the old fashioned way. Is iframe not cool enough? SSI not leetcode appropriate? All of these methods worked fine on 2001.
- deleted 3y ago[deleted]
- Seb-C 3y agoIframes have a pretty bad UX and are ugly and difficult/impossible to properly integrate in any decent design. Also it does not work well with touchscreen and responsive designs. SSI nowadays requires a host with a specific server stack and configuration. Meanwhile, with purely static files it's easy to find high quality hosts or CDNs, even for free. For simple sites, it's much easier to pre-generate the static content and then upload the output files (Web 1.0), rather than dynamically generate it for every HTTP request sent to the server (Web 2.0).
- deleted 3y ago[deleted]
- forgotpwd16 3y agoBecause writing text in plain text files and maybe having markdown for formatting is more preferable than shoving it in HTML files. Also reducing redundancy is nice, e.g. having header in its own file rather copied in every page.
- 3y ago
- fuzztester 3y ago>And so Jinjabread was born! Mouth-watering. May we have some garlic butter with that? Upvoted ya for having good taste ;)
- rcarmo 3y agoVery nice. Like my own stuff, you have an index file and dependent media per folder, which is the only real way to scale out beyond a few dozen pages (my site has… a few more - https://taoofmac.com/static/graph https://taoofmac.com/static/graph) One suggestion I’d make is to do two passes—one to index all the inter-page links, another to actually render the templates. I do that (and full text search) with SQLite: https://github.com/rcarmo/sushy/blob/master/sushy/models.py https://github.com/rcarmo/sushy/blob/master/sushy/models.py
- cantSpellSober 3y ago> Prettify all generated HTML (because why not?) ..because it makes the files larger? I see why it's useful during dev though. (Great name!)
- Retr0id 3y agoI'm a bit confused by this too. My static site generator also generates mostly-pretty HTML, but not because there's a prettification pass, it's just because the templates themselves are pretty (because I wrote them that way). Surely the prettiness of the source that you actually edit is even more important than the final result?
- hunter2_ 3y ago> Surely the prettiness of the source that you actually edit is even more important than the final result? A pretty final result can help with all sorts of future scenarios, like piping curl into grep for quickly checking if something exists. Similarly, I despise CSS preprocessing since figuring out a solution in the browser then has to be backported, hopefully with a source map to assist.
- Retr0id 3y agoRight, that's why I don't use minifiers. My pretty templates render to pretty HTML, with no additional prettification pass needed.
- forgotmyinfo 3y agoGzip exists, and text compresses pretty well. Unless it's 20 MB of JavaScript just to render some text, that you're best just removing.
- brainzap 3y agoI also format my blog HTML, I cant say why, but I want it to be tidy and readable.
- 3y ago
- nsonha 3y agowho needs this feature? If there is a need for it this should be done in the browser anyway.