I've tried Jekyll in the past but the setup is a bit overwhelming and it gets complicated super fast. I am looking for something where I can keep my header and footer separate and then include them in every other page. That's it. No CMS and no blog. Is there something which handles this well and is easy to set up?<p>I use Cloudflare Pages to host my website
For simply including a common header & footer in pages, any server side include (SSI) compatible server will do: Nginx, Apache, or Caddy.<p>With SSI, your template for every page would basically look like this:<p><pre><code> <!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<!--#include virtual="/ssi/head.html" -->
<title></title>
<meta name="description" content="">
</head>
<body>
<header>
<!--#include virtual="/ssi/header.html" -->
</header>
<main>
</main>
<footer>
<!--#include virtual="/ssi/footer.html" -->
</footer>
</body>
</html>
</code></pre>
Making your own SSG is another good solution. They're easy to make, and you can tailor them to your own particular needs.
gcc -E was my first SSG. Run it on files like this...<p><pre><code> #include "templatestart.html"
<!-- Content -->
#include "tenplateend.html"
</code></pre>
Eventually a combination of wanting faster speed and NIH syndrome made me write my own that did significantly less parsing and processing.<p>Then I built that into a live update system I called TCUP (torstenvl's content update program).<p>It was a fun project, and ended up being the first non-trivial program I wrote (I was 17-18).
I suggest you to try out Eleventy (<a href="https://www.11ty.dev/" rel="nofollow">https://www.11ty.dev/</a>)<p>Quite simple to start, and a nice system to add some scripting and styles without the requirement of bringing in a framework.
Hugo comes out of the box with headers and footers, but you'll probably want to grep around a bit before you understand them fully. I can still recommend my <a href="https://github.com/Siilikuin/minimum-viable-hugo">https://github.com/Siilikuin/minimum-viable-hugo</a> as a decent way to get started with a "gears first" approach to Hugo, even though recent developments have made it a bit outdated (in a good way!).
Pandoc can be your friend. My site maker [1] is built around it.<p>I think a hundred or so well-chosen lines of your favourite scripting language can do wonders. Mine is ~300 lines of Bash because I over-engineered a thing or two for kicks. The core of it is maybe 50 lines.<p>[1] <a href="https://github.com/adityaathalye/shite">https://github.com/adityaathalye/shite</a><p>The README documents the architecture and rationale. Maybe it will help you figure out yours. Happy hacking!
Well, I built my static website generator out of Bottle - a single-file HTTP framework that has built-in templating. Bolting on a route that renders Markdown files is pretty simple, really, and a simple os.path.walk() and directly calling the routed function will let you do everything you need.<p>So you only really need bottle and markdown in your requirements.txt, and around 100ish lines of code. Maybe a little more if you want to upload the results to Cloudflare directly (for which I’d use requests).<p>You can rinse and repeat that with aiohttp and markdown if you want the async flavor (which is what I’d do these days if I hadn’t already “finished” mine).<p>And, if you’re into LISP… <a href="https://github.com/rcarmo/sushy">https://github.com/rcarmo/sushy</a> might make for some fun reading.
Ugh, this might be an overkill suggestion but Next.js is really easy to work with, and your goal can be accomplished super easily.<p>Cloudflare page for deploying Next.js static site:<p><a href="https://developers.cloudflare.com/pages/framework-guides/nextjs/deploy-a-static-nextjs-site/" rel="nofollow">https://developers.cloudflare.com/pages/framework-guides/nex...</a><p>On the sidebar they provide a ton of other guides for different generators, too.
For a use case that straightforward isn’t the simplest SSG going to be:<p><pre><code> cat header.html body.html footer.html > page.html
</code></pre>
??
I keep wondering about this, but you know what? I just keep using Blogger from Google.<p>It's there, it works, and it's totally simple. I don't have to do any maintenance or worry about hosting or a domain name.<p>Images go into my Flickr account, and I save a copy of each post's text, in case I ever want to do something else. But not so far. Been on Blogger since 2009.
> I am looking for something where I can keep my header and footer separate and then include them in every other page.<p>Are you married to markdown or is HTML markup sufficient[1]? Because just using a single 5-line web-component is sufficient for a shared header/footer on each page.<p>I have a tiny web-component that does this (the shortest I saw in the wild is a 5-line one). Lets you do things like this:<p><pre><code> <html>
<body>
<zjs-include remote-src="./header.html"> </zjs-include>
... content ...
<zjs-include remote-src="./footer.html"> </zjs-include>
</body>
</html>
</code></pre>
[1] Although markdown does let you include verbatim HTML, so you can use web-components directly within markdown too. A 2-line bash script to call pandoc to turn markdown into HTML is sufficient.
Maybe a bit too elaborate for your taste, but I've used <a href="https://astro.build/" rel="nofollow">https://astro.build/</a> and loved every bit of it.
You haven't given detailed specifications, but if you're writing the pages in markdown and you have Pandoc installed, this simple Makefile will do what you want, where website.html is your Pandoc template:<p>files := $(patsubst %.md,%,$(wildcard *.md))<p>all:<p>for f in $(files); do \<p><pre><code> pandoc -s -o $$f.html --template=website.html $$f.md;\
done</code></pre>
I have used Caddy and its Server Side Include functionality (templates) to take care of repeating elements like header and footer etc. Does not get much simpler than that.
I would recommend just writing one yourself. It's not very hard, and the process of writing it will make you intimately familiar with how it works, so you won't feel overwhelmed.<p>Just writing simple software feels way better than reading docs for an arcane tool that will change on you over time due to updates.
Hugo has gotten easier recently to get up and running. Seems to come prepackaged with a simple, workable "template" when you create a new site. :)
> I am looking for something where I can keep my header and footer separate and then include them in every other page.<p>As others have said, this is a perfect fit for SSI. You could also deploy a simple php page (just using php as a template engine with server side/host support).<p>I've experimented with m4 for something similar in the past.<p>I would probably recommend going with Hugo, though:<p><a href="https://discourse.gohugo.io/t/solved-using-html-for-content-pages-instead-of-markdown/3374" rel="nofollow">https://discourse.gohugo.io/t/solved-using-html-for-content-...</a><p><a href="https://gohugo.io/getting-started/quick-start/" rel="nofollow">https://gohugo.io/getting-started/quick-start/</a><p>An article from 1997 on using m4 and make - would strongly recommend just using php cli these days...: <a href="https://tldp.org/LDP/LG/issue22/using_m4.html" rel="nofollow">https://tldp.org/LDP/LG/issue22/using_m4.html</a><p>For rolling your own in php, see:<p><a href="https://rosswintle.uk/2021/12/hang-on-php-is-a-static-site-generator/" rel="nofollow">https://rosswintle.uk/2021/12/hang-on-php-is-a-static-site-g...</a><p><a href="https://www.dah5.com/staticphp/" rel="nofollow">https://www.dah5.com/staticphp/</a>
I use Hugo, have considered moving to something more modern, but it just works.<p>All questions I have, are solved by ChatGPT, e.G. adding "_small" to jpgs.<p><pre><code> {{ $newImageURL := replace .Params.image ".jpg" "_small.jpg" }}
</code></pre>
so I don't need to learn or remember Hugo API.<p>Quite recently I've added jamstack to reduce image sizes etc. to make the site faster.
I use GNU make and obsidian. Write content in markdown, feed it to <a href="https://github.com/commonmark/cmark">https://github.com/commonmark/cmark</a> to create html. I intended to splice files together using xslt but echo and cat written in the makefile sufficed.<p>Plumbing is a bit obfuscated, not sure I've written it down anywhere. I write/edit files in obsidian or emacs. The obsidian sync feature copies those to a pi5 which also runs obsidian. That stashes whatever is in the directory into a fossil repo as a backup / sync to other machines mechanism. Something runs make periodically to rebuild the site which gets copied back into obsidian and thus ends up back on whatever device I'm using to edit the files.<p>A simpler setup would involve committing markdown to a github repo and having a cron/make somewhere pull from that, rebuild the site, commit to the same or a different github repo.
That was what Server Side Includes[1] were exactly for. It comes built-in with Apache. I don't think Cloudflare Pages does it but looks one of the build tools supported by CloudFlare Pages, and choose the simplest one you find. Own and keep the content with the option to just keep changing the tool -- then keep trying till you find the ones that suits you best.<p>1. <a href="https://en.wikipedia.org/wiki/Server_Side_Includes" rel="nofollow">https://en.wikipedia.org/wiki/Server_Side_Includes</a>
I'm currently using Zola, but a recent HN article reminded me to try Soupault along with Pandoc.<p>Soupault is more geared to the use of external tools and plugins, which can make it more complicated. But if you already know the tools you're going to hook up to it, it's easier in the end.<p>- <a href="https://github.com/PataphysicalSociety/soupault">https://github.com/PataphysicalSociety/soupault</a><p>- <a href="https://github.com/getzola/zola">https://github.com/getzola/zola</a>
It might not be the simplest but it was the first I learned so it's simple to me.<p>Flask with jinja, then you just do {% extends layout.html %} etc. It might be overkill but it's not that hard
Hugo without a theme and some simple CSS could do that.<p>Feel free to clone this repo: <a href="https://github.com/cpach/piper">https://github.com/cpach/piper</a>
Do you have a preferred programming language? Whether building your own or using a framework, you’ll need to deal with the ecosystem. There’s lot is boots recommendations here, but if going for easy, I would make the initial decision based off what environment you’re already most comfortable with (JavaScript, Python, go, bash). In general I’d prefer an ssg over server side includes because there’s so many easy and free CDNs that you can use
>I am looking for something where I can keep my header and footer separate and then include them in every other page. That's it.<p>PHP. That's literally the one thing it does well. You <i>should</i> still use a framework (is Slim Framework still a thing? It's small, if it is) for routing and escaping but as long as your header and footer are pure HTML then you can just include them.
I made a very barebones one called barf. It's ~100 lines of code.<p><a href="https://barf.btxx.org" rel="nofollow">https://barf.btxx.org</a>
<a href="https://blot.im/" rel="nofollow">https://blot.im/</a> is the one that finally made it possible for me to use one without configuration of both a web server and a site generator (neither of which I can do) and keep my files "local" in a synced Dropbox folder.
I found it quite simple to use Jekyll, could be because I used a ""butler"" for it - found Poole[1] pretty good to get started with.<p>Also I guess since I'm a Ruby dev a lot of Jekyll stuff made sense to me pretty quick.<p><a href="https://getpoole.com/" rel="nofollow">https://getpoole.com/</a>
I use Jekyll just for the footer and nav/header. No blog and no cms. Not using sass or markdown. I installed it once, made everything local and turned it into a zip that a bash script unpacks into a name.local folder. Simple enough for me. Gem file just calls Jekyll current version and done.
Astro is amazing. I built my blog with it, hosted on CF pages [1].<p>DX is great.<p>In most cases, ships absolutely zero JS to the client, meaning super fast load times.<p>[1] <a href="https://www.yusufbirader.com/" rel="nofollow">https://www.yusufbirader.com/</a>
Check out "Dumb Site Generator"<p><a href="https://so.dang.cool/blog/2024-01-22-DSG-Dumb-Site-Generator" rel="nofollow">https://so.dang.cool/blog/2024-01-22-DSG-Dumb-Site-Generator</a>
You can check <a href="https://freeweb.me" rel="nofollow">https://freeweb.me</a>, when the editing part is completed, you download your website in zip archive, to upload anywhere.<p>It's free.<p>(disclaimer: it's one of my side projects)
I use and like <a href="http://wintersmith.io/" rel="nofollow">http://wintersmith.io/</a>
Very simple to use, enough plugins to cover most use cases.
github pages integration with jekyll.<p>all you need is some setup and a git repo the rest ist done for you and unless you host traffic heavy content it will most likely be free forever.