17 ms·
I understand all this, no objections at all, I just wonder if the easier thing to do here is to write the blog posts in HTML and drop them in a folder for a web
by massysett 2y ago
I understand all this, no objections at all, I just wonder if the easier thing to do here is to write the blog posts in HTML and drop them in a folder for a web server, the same way I learned to do websites 25 years ago. What's making this complicated is the Markdown and if you want something lightweight, Markdown doesn't pull its weight.
- encomiast 2y agoIt seems like we've spent the past 25 years trying to solve the big headache this creates: you have 100 blog posts, which means 100 html files. Any structural change you need to make to the site involves touching all 100 files. CSS came along and helped separate the presentation from the information a bit, but it still sucked to maintain 100 html files on the server.
- xnorswap 2y agoIsn't this what Jekyll solves? Posts are all written as markdown, styling and layout are centralised with layout HTML pages and CSS. I believe indexes can be auto-updated via post metadata. And it's all static pages once generated, so there's no dynamic load on a database.
- mid-kid 2y agoI generally just have a makefile that for each page does `cat header.html page.html footer.html > out/page.html`. I realize this can be considered a "static site generator" but I think simple concatenation covers most of the painpoints of writing static sites manually, without introducing intermediate formats and complex processing. Another option is PHP, which was practically made for the purpose of generating HTML. You can run it on your pages to generate static versions, and just use "include" directives with that.
- thombles 2y agoYou're right but in my experience the annoyance factor jumps up as soon as you start wanting an RSS feed.
- skydhash 2y agoI wonder if you can have a snippet for that (can be a script that generate the code for one item) It’s not like such blog is updated thrice a day!
- glandium 2y agoOr "server side includes".
- jimmaswell 2y agoPHP is perfectly sufficient here. Add a static cache if the overhead gets too much.
- ryao 2y agoThere are static site generators. There are even plugins that turn Wordpress and Drupal into static site generators, such that you do not need to edit the files one at a time to make changes.
- imgabe 2y agoI sometimes go down this rabbit hole and wonder why people don't use server-side includes to just have Apache or nginx handle a common header / footer or whatnot. Seems like what they were made for. Are they slow or something?
- carlosjobim 2y agoThey're instant and they work great. PHP includes also.
- lelanthran 2y agoClient-side includes are easily done in a custom web component now. I use one. You can write a simple one in about 60 lines of JS. If all you need is include functionality, then that's the way to go for static file hosting.
- drwu 2y agoI totally agree. Just using a POSIX shell to concatenate header/footer and include the required CSS file, a simple static blog generator can be easily made. (That is what I did with mine.) No Markdown, no Perl/Python/Ruby, also no binary program, just a few simple shell scripts and plain HTML files.
- tiehuis 2y agoUsing a portable minimal markdown dependency (such as cmark [1]) I think markdown can be quite a low barrier here. I personally do similar to what you have described on my blog, with an additional cmark conversion and find it quite simple [2]. [1] https://github.com/commonmark/cmark https://github.com/commonmark/cmark [2] https://github.com/tiehuis/tiehuis.github.io/blob/38b0fd58a2954709a4a1c916e6b9e09144059419/Makefile https://github.com/tiehuis/tiehuis.github.io/blob/38b0fd58a2...