14 ms·
I Built My Own Shitty Static Site Generator
- JasonFruit 6y agoFor me, the reason was simpler: it took less effort to write an SSG than it did to learn any existing one, and I got the fun of doing it.
- blakbelt78 6y agoNice. That gave me inspiration to finish my shitty SSG. It already powers my personal blog and my wife’s as well but it need some polish for a full launch
- no_wizard 6y agoI have found when I’m looking at the top static site generators they always lack a good programmatic API in one way or another. Either you can’t change defaults if needed, or hook into the build itself in some meaningful way, or it’s a shell they requires deep customization in areas you may not be prepared to take on. Doesn’t mean Hugo, 11eventy, Jekyll etc aren’t good it’s just an area that could still have mass improvement I think
- StavrosK 6y agoI've found Lektor's API decent. It's easier when the generator is written in an interpreter language, as compiled languages generally have a harder time exposing their APIs.
- azhenley 6y agoIt’s such a simple thing to make. It’s easier than trying to figure out and customize someone else’s.
- k__ 6y agoThis. The complexity in most SSGs comes from them being generic solutions. If you have a fairly simple site and know what you need, you probably get it build with a few lines of JS and a GH action.
- ngcc_hk 6y agoAny example?
- powersnail 6y agoWriting a SSG for oneself is just like writing a single Makefile, for one small project, with one contributor, without cross platform concerns. Using a generic SSG is like learning CMake.
- p4bl0 6y agoThis is quite well put. Althought most of the times using a generic SSG feels more like learning the autotools than CMake.
- mattgreg 6y agoIf helpful, we open sourced our static site at Ockam.io https://github.com/ockam-network/website https://github.com/ockam-network/website
- kayodelycaon 6y agoI love these posts on static site generators. They are a constantly reoccurring topic. Everyone wants something that's "easy" and "simple" but this is at odds with having flexibility to handle more than one person's favorite workflow. There's endless discussion because there are endless solutions. Personally, I've used a number of static site generators and I ended up in the opposite direction. I needed a website where I could write posts and not have to worry about more than just writing and posting, no deployment, no plain text intermediate languages between me and the end result. I ended up using Wordpress. I was already familiar with it, knew how to self-host it, and was comfortable modifying a theme to suit my purposes. Writing and posting new articles is so much easier using rich text. I generally type up my post in Apple Notes first. Copying and posting to Wordpress saves most of the formatting. Inserting images is drag and drop. Large numbers of good plugins meant it was easy to find something to implement features like having a click-through warning on 18+ posts. Install a plugin, configure it, and I'm done. Wordpress works well for me, but a lot of programmers are rightfully horrified. Wordpress is popular and complex, which results in a long history of security issues requiring mitigation. It's inefficient and needs caching. It needs to be backed up because everything is in a database, not plain text. As a result, it requires more systems knowledge than a static website. Static site generators and applications like Wordpress are tools. Everyone ultimately looks for a tool that works for them. My goal is to write posts, not fiddle endlessly. Other people love the fiddling. So, if you’re looking to build and maintain a website, think about what’s important to you. What’s your skill set, interests, preferred workflow, and goals?
- bamboleo 6y agoSometimes I wish I could just use WordPress as a static site generator off of a docker machine that turns on on login and off at log off. Nobody wants to deal with slow and insecure always-on WordPress sites. I know that there are some websites that take care of this… for money. Unfortunately $20/month is not in the budget for one-off sites.
- neurostimulant 6y ago> Sometimes I wish I could just use WordPress as a static site generator off of a docker machine that turns on on login and off at log off. But you can do exactly that right now. For example: - use wordpress as your data backend in next.js - not exactly a static site generator, but you can use w3tc plugin to perform full page caching with very long expiry time, which essentially turns your wordpress site into a static site. You can also do this using cloudflare "cache everything" page rule, but it must be paired with another page rule to skip caching if wp cookie found. Similarly, you can add web app firewall rules on cloudflare to disallow login access except for you.
- pydry 6y agoThere's no shortage of static site generators but I've yet to find one I didn't find frustrating. Only like, 3 seem to have any significant number of themes and half of them don't seem to work with the latest version of the generator.
- lazyjones 6y agoStatic HTML served through a bad / misconfigured httpd is worse than some integrated solutions. Some years ago everybody was using Apache, a terrible implementation.
- kayodelycaon 6y agoThe problem with Apache was people using the default config on small servers. Forking per request without proper limits on a small server? Zero to Swap at a hundred requests per minute. Less if it was using mod_php.
- lazyjones 6y agoThe whole architecture was bad... Try serving static pages from an Apache configured with (and using, for some other user) mod_perl, for example. My point was that the whole setup counts, not just the fact that the pages are static. I'd rather serve content from some small Go executable than Apache + static pages. But apparently it's undesirable to point such things out. Best if I don't post anymore.
- xorcist 6y agoUsing mod_perl wasn't the best example, perhaps, as it works as one would expect and only starts a few Perl interpreters in the process which runs multiple threads. It is famously mod_php that isn't good in this regard and will naively start one interpreter per request. Since PHP 5.4 (released in 2011) everyone should just use PHP in FPM mode instead. The fact that mod_php only supported preforking caused a lot of spite and angst against PHP the language, which was understandable but perhaps a bit misguided. None of this has anything to do with Apache, of course. No web server should have any trouble serving static pages at any speed and you could do much worse than Apache.
- Jaruzel 6y agoYour problem with your first post was that you said: Some years ago everybody was using Apache, a terrible implementation Without backing that statement up and explaining why. Your post came across as simple flame-bait. Nevertheless, please keep posting. Contrary opinions count. Without them, the world becomes the ultimate echo chamber.
- mikey_p 6y agoI don't think the author is wrong for wanting to use something different or write their own tool, but the YAML front matter format is much bigger than just Hugo. There are tons of libraries out there, and even Github has a special viewer for Markdown files with front matter. e.g. Ruby: https://rubygems.org/gems/front-matter https://rubygems.org/gems/front-matter Python: https://pypi.org/project/python-frontmatter/ https://pypi.org/project/python-frontmatter/ Javascript: https://www.npmjs.com/package/front-matter https://www.npmjs.com/package/front-matter PHP: https://packagist.org/packages/webuni/front-matter https://packagist.org/packages/webuni/front-matter Go: https://github.com/gernest/front https://github.com/gernest/front Elixir: https://github.com/sebastiandedeyne/yaml_front_matter https://github.com/sebastiandedeyne/yaml_front_matter Clojure: https://github.com/liquidz/frontmatter https://github.com/liquidz/frontmatter And many of those languages have more than one library. Like it or not front matter in Markdown files is a bit of a standard these days.
- kayodelycaon 6y agoAnd it's not difficult to deal with it manually. Grab the first line as the delimiter and split the document on the next occurrence. Personally, I find it a bit silly to optimize for outputting things in many different formats when you'll have to deal with tweaking the output for each format to get it right. And it's not a one and done deal. You'll still find things going wrong on occasion. :)
- joshribakoff 6y agoYeah my gatsby blog uses it too. Not sure why the author claimed only Hugo supports it.
- samatman 6y agoI'm fairly sure it came from Jekyll originally, rather than Hugo.
- zhte415 6y agoYahoo.
- 6y ago
- spacemanmatt 6y agoI respond very positively to the notion of "shitty" just being another way to express that it scratches the author's itch but probably only the author's.
- EGreg 6y agoWe made a static site generator that goes over ANY dynamic and renders a bunch of URLs to static HTML in the “same folder” for purposes of referencing relative paths for resources. We had two main issues... one is that links to dynamic pages would need to either be rewritten to static ones, or the dev ops would have to our 301 redirects for the list of dynamic URLs which we rendered, to the corresponding static html pages. The other issue is that various aspects of the page would be related to authenticated sessions, and should NOT appear in the static site generated resources. Any ideas about these issues?
- kayodelycaon 6y agoYou could solve some of this by having a small script as a fallback. PHP would be my goto; it's pretty fast for simple things. Another alternative is to have your generator create an nginx config with the redirects. (W3 Total Cache for Wordpress does something like this)
- neurostimulant 6y agoWhy not serve the generated static content from a different domain? Assuming all links to the dynamic pages are relative, you don't need to rewrite the urls that way. Alternatively just update the crawler to rewrite any url that matches certain rules. As for hiding certain element, maybe appending some simple css to the generated pages to hide them is enough? something like `.login-form {display: none !important;}`
- gpnt 6y agoI wrote my static site generator, too. It is a lot of fun, and much more powerful for my specific use case than any other around (and probably would fail miserably for any other use case). It took 2-3 days and I regret nothing. There are some novel things though, like, I use markdown files, but separate sections with ``` so I can use different inputs like ```MD for markdown, or ```JSON for pure JSON data, or ```PHP for PHP code. The VS Code highlights the portion of the code correctly, so I can work on many formats/languages on the same page. The .md file looks like this: ```INI META includes = docs/index.html.md menu menuTop title = Theme base = docs/docs.html slug = theme ``` ```JSON menu [ { "label": "Demo", "url": "/demo/features" }, { "label": "Try it!", "url": "/try.html?d=/data/try.json" }, { "label": "Docs", "url": "/docs" } ] ``` ```MD BODY # Customize the story Below are the parameters to customize the style of the story. ``` Then I use a PHP script to serve the content live when in development (no compilation, very fast) and a deploy script to generate the HTML files and upload to AWS S3. Works perfectly.
- bamboleo 6y agoCool but why not just use regular MD with YAML front matter? I don't find that JSON readable at all, comparatively, and that INI isn't any better than the YAML version. --- includes: docs/index.html.md menu menuTop title: Theme base: docs/docs.html slug: theme menu: - label: Demo url: /demo/features - label: Try it! url: /try.html?d=/data/try.json - label: Docs url: /doc --- # Customize the story Below are the parameters to customize the style of the story. And… PHP in a MD file?
- gpnt 6y agoThe MD file is just for information, and I want to consume this information in different forms. The MD file is just to highlight the code correctly on VS Code on a single file. The PHP script interprets each section and processes it accordingly. This way I am not limited to markdown. For example, for documentation, I use markdown, but for the website, that I want to control the layout better, I use JSON only, and when I need to create complex operation (as a consult to an external database), I use PHP. The markdown is very limiting, this was the motivation to create my own.
- deleted 6y ago[deleted]
- arpyzo 6y agoI completely understand the desire to build something practical that's your own. I just built a small web application framework that I can build some basic personal apps on top of. Just like the author's, it's "shitty". It lacks features, doesn't handle edge cases, isn't particularly secure or performant. None of that matters. It's locked up behind HTTP authentication and it's for my use only. It has exactly the features I desire, and none that I don't. I understand it top to bottom. It was fun to write and extend. It serves my needs perfectly. I didn't have to fight with, or conform to someone else's notion of how software should be built.
- crdrost 6y agoI wish I could upvote this multiple times. You go into any experienced woodworker’s shop, you can divide it into maybe 20% of the tools that see the vast majority of the action—table saws, band saws, milling machines, proper hammers. But then there is a halo of 60% or more of the things there are little helpful things—doodads, mallets, jigs, often even shelving and work surfaces—such that she uses a bunch of these on any build she undertakes, and she made them herself. “Why would I stumble around with someone else's mallet when it’s about the same cost and about half a day’s work to machine my own mallet down in a router that has exactly the weight and shape that I like it to have? Pays for itself.” We are so far from this ideal. All of our software breaks because we imported left-pad and somebody unpublished left-pad. Wasn't even a world changing perfectly V8-on-x64-tuned performant version of left-pad, but we gotta “not reinvent the wheel.” I don't think we do it for no reason, there is something about software itself right now that is amateurish. We’re still writing subroutines working on data structures; our brains are FORTRAN even if we call it Java, and whatever that is makes it really hard to decouple the tools that we are using to build software from the final outcome that has been built. The woodworker has a sense of the “shape” of the artifact, we routinely build the equivalent of gorgeous wooden tables that start spewing garbage onto their shiny surfaces after three weeks unattended, “oh, I didn’t realize that the built-in trash chutes could get clogged.” Wait—what? “Yeah, we allocate more wood at the bottom of the table to make up for the wood that we remove at the top of the table every night so that the surface is always clean.” Your user doesn't clean the table? “Hahaha you’re silly, users could not possibly have the technical knowledge to keep anything clean, they are not trained in sponges, and I especially could not trust the with something as beautiful and delicate as this table.” The problem has a beautiful sort of fractal quality to it, every zoom-in is more WTF.
- deleted 6y ago[deleted]
- bogwog 6y agoI spent about a day migrating my personal site from grav to hugo, and the main takeaway I got from that experience is that both of these "simple" static site generators are ridiculously over-engineered. I could slap something together with a few lines of Make or Python that does exactly what I need, in an hour or two. I could even hook it up to AWS and have it update automatically. Doing all of that is less time consuming and requires less effort than reading through the grav or hugo documentation, installing and setting everything up, and troubleshooting the inevitable problems. The only issue I have is that doing front-end web development/design is not something I enjoy, so grav and hugo's existing library of themes is very convenient. Convenient enough to put up with the other annoyances.
- lqet 6y ago> I could slap something together with a few lines of Make or Python that does exactly what I need Here is a static page generator implemented in a 200 LOC Makefile: https://github.com/patrickbr/hagel https://github.com/patrickbr/hagel
- susam 6y agoStatic site generator in 130 lines of Python (excluding comments, docstrings, and blank lines): https://github.com/sunainapai/makesite https://github.com/sunainapai/makesite Disclosure: My wife developed this project.
- KajMagnus 6y agoo.O @cat $(dir $@).$(notdir $@).$(notdir $<).newlesc.tmp | tr -d '\n' | sed -e 's|\([$(ALLWD_VAR_CHRS)]*\)={{|\n\1={{|g' -e 's|\\\([^n]\)|\\\\\1|g' -e 's|/|\\/|g' -e 's|\&|\\&|g' | sed 's|\([$(ALLWD_VAR_CHRS)]*\)={{\(.*\)}}| s/$$$(strip $(subst .,,$(suffix $(patsubst %.info,%.category,$<)))){\1}/\2/|' > $@.var.sub.tmp So much `sed` and Bash one liners so I almost get a fight-or-flight reaction :- ) Edit: Now I see in the readme: > Error messages are for the most part cryptic errors from sed. Most of them are entirely useless to you. A quite honest readme & project :- )
- sergiomattei 6y ago
- throw93 6y agoCan’t seem to load the website.
- throw93 6y agoNvm, looks like it was temporary problem.
- enter-haken 6y agoSome markdown parsers allow you to take a look at the AST. I used it to replace a code section containing dot code with a png. or using comments like <!--more--> to generate site Teasers. https://github.com/enter-haken/book/blob/master/lib/generator/markdown.ex https://github.com/enter-haken/book/blob/master/lib/generato... You can use pandoc to convert markdown in almost every format you like. I use it to write letters. https://hake.one/blog/letter.html https://hake.one/blog/letter.html If you have access to the AST, you can integrate as much metadata as you like.
- CGamesPlay 6y agoNothing wrong with writing your own SSG (I recently rolled my own solution for my blog as well), but the most important part of the new solution is glossed over by the author: documentation. What's critical, regardless of the solution you use, is to get a runbook of your software. By way of example, my hand-rolled blog has a README file which lists these things in it. Whenever you pick up a new SSG or create your own you should make sure that you have a good plan for at least these things: 1. How to start writing a new post. For me, that's the script to fill out the template, plus the instructions to run the dev server. 2. Frontmatter fields supported. If there's too many to list all of them, at least list every one you've used before, since you'll probably use those again. 3. Tools for writing. For me, that's a few scripts to do things like properly import media. 4. Publishing. This is a full checklist including "verify mobile", "verify excerpt on posts page", "run publish/deploy", "submit to these sites". One of the reasons your personal SSG feels better than anything is because you know every nook and cranny in it. That feeling will go away after about 6 months, and you'll thank yourself for having written good documentation.
- necrotic_comp 6y agoAgreed. Additionally, this should go for every piece of software you write for yourself, not just your SSG.
- tantalor 6y agoI've never heard the term "runbook" before, but it sounds very useful. Thanks! https://en.wikipedia.org/wiki/Runbook https://en.wikipedia.org/wiki/Runbook
- neurostimulant 6y agoLike many other in this thread, I too built my own static site. It implements only parts of Jekyll that I use and nothing more: theme and markdown-based content with front matter. It's implemented in Flask using Frozen-Flask and didn't took long to write. I think I spent a weekend to write, tweaked the theme and migrate my contents to it. I don't have the same need as the author though. If I want to post something that is not a blog post (e.g. a page that showcase a particular personal project), I'll just post it as a standalone page and add whatever custom stuff the standalone page needs in the theme.
- smasher164 6y agoI totally agree on this matter. There's something really empowering about writing your blogging stack from scratch. I did this a couple years ago (https://github.com/smasher164/akhil.cc https://github.com/smasher164/akhil.cc), and I might even do it again to scale it out. I wanted to extend markdown with latex and graphviz, and wrote an extensible markdown that grabs output from code execution (https://github.com/smasher164/mexdown https://github.com/smasher164/mexdown).
- dragonsh 6y agoIt's good author wrote his own static site generator. If he implemented using restructured text specification it will be future proof and maintainable along with using multiple tools like pandoc, sphinx, pelican, nikola and obviously python docutils itself for generating different format outputs. Eventhough markdown is popular, its not a standard speicification. If author wanted to work with something which works for generating output for a website, pdf file or an ebook, he should have looked into a proper standard like RestructuredText (RST). I think rst is much cleaner and better specification than markdown. Given its a specification there are multiple implementations available. So may be community should adopt it with more open arms. Still wonder like xsd vs relaxng in this case also markdown being inferior implementation without specification is winning over rst (restructuredText) format and specification.
- isbjorn16 6y agoI find RST simply miserable to write and even worse to read. All of your points are valid regarding it being an actual spec, but reading and writing it in the raw vexes me to no end. I still use it for my module documentation, but I still use Jekyll for my personal sites instead of something like Sphinx (which is another element of hell for me - the errors when your RST is wrong are worse than useless; > "You have an error somewhere between _here_ and _here_" "You just pointed to everything" > "Yes I did"
- Tomte 6y agoAsciiDoc(tor) is worth a look, it's better specified than Markdown (and has much features), but doesn't look as ugly as restructuredText. It's quite niche, though. And if you don't want the Ruby dependency, AsciiDoctorJ is very usable.
- deleted 6y ago[deleted]
- AnonHP 6y agoThanks for writing this. Though the post was a bit too long for me, I skimmed through it and got many relevant points. I’ve been thinking about using an SSG, but have found it difficult to decide on which one would be easy to use and also less restrictive for my (simple) needs. The trade offs between any SSG and platforms like WordPress or Twitter are clearer. They sit on a spectrum of predefined needs, and figuring out what matches your needs is the key (and also the cause for analysis paralysis).
- sqldba 6y agoJust try Hugo. Jekyll is okay but extremely slow with hundreds of Ruby plug-in dependencies and nonsensical breaking changes between versions. The author is pedantic and seems to just not want to use other tools. That’s fine. But this is a dumb road for others to follow. Remember the entire thing started because they don’t like front matter. They could literally have written a script to parse front matter, which are literally a few plain text lines. Then they wanted asciidoc but without the dependency. Except their own code will likely have an asciidoc dependency unless they wrote their own entire asciidoc parser. In which case they could also have done this and plugged it into the same script. “You don’t want to get stuck into the thinking of others,” they scream into the wires, followed by hobbling themselves into the most minimal viable product straight jacket imaginable. Fool programmers and their time are soon parted.
- rammy1234 6y agoThis post kinda reflects my thoughts as well. Picked it as a hobby to explore writing a static site generator. I wrote mine in nodejs. https://github.com/rammygit/homegrown https://github.com/rammygit/homegrown , it again a shitty SSG but again i enjoyed the process of exploring
- mark-r 6y agoI have yet to start the blog I've been thinking about for 10 years. But I fully intend to build my own SSG for it. I gave a lot of thought to my motivation for doing so, and reached a simple conclusion: programmers gotta program. A blog is all about self expression, and the purest form of that is the code that drives the blog.
- BlahGod420 6y agohttps://www.youtube.com/watch?v=XKVImK7DFFU https://www.youtube.com/watch?v=XKVImK7DFFU
- deleted 6y ago[deleted]
- Bayart 6y agoI've been looking for static site generator myself and, as often with OSS, found myself overwhelmed with the offer of seemingly identical yet subtly different generators. There's the old xkcd joke about solving the standards problem by creating an Nth one, but really that might be better than decision paralysis.
- h3rald 6y agoI agree 100%, but more than anything for me was control: I had been using nanoc (https://nanoc.ws https://nanoc.ws) for years and don't get me wrong, that's an excellent piece of software... but then I "left it" for a few months also because I stopped coding in Ruby for a while (and stopped blogging) .When I came back to it, I discovered that a new major version was out and I had to upgrade, potentially breaking quite a bit of things because I didn't keep the pace with the new changes. While this is true for nearly all software, I missed being in control of when to upgrade, and I also missed a few little features here and there. The result? I shopped around for it a bit and then decided to roll out my own: HastySite (https://hastysite.h3rald.com https://hastysite.h3rald.com) which now powers a bunch of sites of mine like https://h3rald.com https://h3rald.com and https://min-lang.org https://min-lang.org Actually I ended up writing my own markdown processor and my own programming language before doing that (which also needed a Readline/line noise replacement, and wrappers for a regexp and compression library) but... hey, that's part of the fun isn't it? That's the very reason why I love being a programmer: it's not about the final result, it's about how you get there and what you learn along the way. So kudos to you sir, I wish you all the best and that you build more things yourself.
- petepete 6y agoWhy did you have to upgrade? You can pin any version you like in your Gemfile and use it in perpetuity.
- deleted 6y ago[deleted]
- biren34 6y agoI too have a shitty static site generator. My issue was mostly long term backup. When you think about keeping your writing around decades--ie, longer than you might keep a site--there's no solution I loved. I also love Scrivener for actually writing. So I built a SSG that takes exports from Scrivener and turns that into webpages. I get to use my writing tool of choice + I have full backups and the ability to recreate the site on demand. Also, Scrivener has metadata as part of the UI, so no awkward front matter. Just some custom fields (as the software already expects).
- Zanni 6y agoI'm surprised there aren't more SSCs (shitty Scrivener clones). Scrivener is by far my favorite writing tool, but it's also the tool that most frequently makes me wish I had the time to write my own version from scratch.
- deleted 6y ago[deleted]
- WalterGR 6y agoI built a shitty SSG in QuickBasic in 1996 to run what is now http://onlineslangdictionary.com/ http://onlineslangdictionary.com/ . Pre-XML! It used a “bespoke” (read: shitty) markup language. Definitely a fun exercise. I bet I still have the code around somewhere. (The QB version was succeeded by a series of shitty SSGs: one written in Visual Basic, one written in Java, and one written in C#, before the current iteration which is backed by a dynamic website.)
- deleted 6y ago[deleted]
- fjfaase 6y agoFor more than 25 years, I am simply writing HTML with only a little CSS and some JavaScript. During that time, I have developed a link checking program, which helps me fixing links and updating the tags. It is a simple C program and rather specific for my needs: https://www.iwriteiam.nl/chkhtml_c.txt https://www.iwriteiam.nl/chkhtml_c.txt It also moves all files that need to be updated to an ftp folder for easy uploading to my hoster.
- franciscop 6y agoI also built (and abandoned!) a small static site generator, and it was as well a very surprisingly pleasant experience. Unless you are doing something very different on purpose, all of the underlying blocks already exist somewhere. You just need to find where and exactly how to combine them, so you are basically writing glue code. It feels even more like a superpower compared to normal programming, you write a few lines and suddenly you have this huge feature working quite well.
- iamEAP 6y agoNot applicable to the author’s reasons for building, but I wonder if “I built my own SSG” is the equivalent of “I built my own CMS” for this generation.
- wheresvic4 6y agoIt's funny, I also ended up building a custom static site generator and it was actually really simple to do so! When I initially started googling around for custom static site generators, I could not find much content so I just wrote a quick post on it: https://smalldata.tech/blog/2018/08/16/building-a-simple-static-site-generator-using-node-js https://smalldata.tech/blog/2018/08/16/building-a-simple-sta...
- gnyman 6y agoLike many other here I looked at a lot of options and ended up writing my own, because spending time finding the right solution (if it existed) was more effort than just doing it myself. Inspired by https://github.com/giuseppeg/xm https://github.com/giuseppeg/xm I ended up writing a absolutely minimal no-frills PHP snippet to turn the PHP file itself in to an html page. https://github.com/gnyman/piss https://github.com/gnyman/piss / https://blog.nyman.re/2020/10/11/introducing-piss-a.html https://blog.nyman.re/2020/10/11/introducing-piss-a.html Doing it yourself is of course not an option for most people. But as the author and many other commenters here, programming is a hobby so the journey is as important as the destination.
- desman 6y agoHave you looked at Lektor? https://www.getlektor.com/ https://www.getlektor.com/ . We use it for in-house needs and we have also built an extension, Lektorium https://github.com/sphericalpm/lektorium https://github.com/sphericalpm/lektorium that allows us to create hosted instances of Lektor for content managers who aren't technical enough to run Lektor locally.
- 5cents 6y agoTiddlyWiki (https://tiddlywiki.com https://tiddlywiki.com), which I think is amazing both in simplicity and flexibility, also offers export to static sites. There are two versions: either the wiki as a single html+js-file or on node.js, but export to static html exists in both. You can test it from the home page (https://tiddlywiki.com https://tiddlywiki.com), just go to Tools in the sidebar -> Export all -> Static HTML. Amazingly simple. Not mine, but a (nice) demo: https://www.mentalnodes.com/ https://www.mentalnodes.com/ and more advanced guide: https://nesslabs.com/tiddlywiki-static-website-generator https://nesslabs.com/tiddlywiki-static-website-generator
- aethertron 6y ago> I want to have one folder for storing all my writing. I want to organize that folder the way I think fits best with the content. Then I want to point the site generator to that folder and it should figure out the rest by itself. Same. I think lots of people would appreciate this. Writing is naturally private (in draft) before it may become public (published). I am tempted to follow the author's path. But I don't think I need to go the whole way. I just need a preprocessor of sorts. I have a folder of markdown files I edit with Zettlr. I could flip a `published: true` flag in the frontmatter. Then iterate over each file and conditionally copy them somewhere to be dealt with by an off-the-shelf SSG (11ty is the current favourite).
- WA 6y agoI also have my own SSG that is basically a little bash script that turns Markdown files to HTML files via 'multimarkdown'. Plus a bunch of PHP and JS scripts: * Extract meta data like categories * TOC generator * Building a search index for Algolia I used 11ty for a project recently and liked it a lot. It's very simple and the nice thing is that it understands several templating languages out of the box. You can basically mix them as well if you want or simply pick your favorite. Would use again: https://www.11ty.dev/ https://www.11ty.dev/
- richajak 6y agoI may consider eleventy in the future as it also supports EJS. It is the template language that I am most familiar, no context switching for my brain. My blogging platform is simply some EJS files glued together with Express. super simple.
- qz2 6y agoI built my own one too. Then I realised I reinvented server-side includes again. So I just went and used those. Again.
- p4bl0 6y agoI wrote a ton of SSG myself. I'm going to talk about three of them. The first is fugitive [1]. It came to life because I just learned about git hooks and thought of using them for generating a blog with all of its meta data in Git itself. I wanted to have only Git as a dependency so I wrote the whole thing in pure sh (not even using some convenient Bash features). It was for fun and for just myself initially but it had maybe like two dozen users in the end, some of them even contributed to the project or maintained their own forks. The second one is not released. It's what I use for my own web page [2]. It's a make file + a few Bash scripts that make use of xml2 parse an HTML template and content files, then uses the GNU coreutils (mostly sed) to insert the content in the template and adjust a few things, and finally use 2xml to build the final HTML document. It also has two additional scripts: one that can take an XML file and build either an RSS feed or an HTML output to be inserted into a page, and one that can build an HTML representation of my list of publications. The third and most recent one is called cigala [3]. It was written for people around me with no web development experience but who needed a simple web page (typically people in academia outside CS). It's a single PHP file that uses SQLite to store the CMS content and is able to build static HTML files whe you want to publish your website. It was originally run from my own server where I created accounts manually each time someone asked me to. But it now is available for larger use and is easy to install as well. [1] https://code.up8.edu/pablo/fugitive https://code.up8.edu/pablo/fugitive [2] https://pablo.rauzy.name/ https://pablo.rauzy.name/ [3] https://code.up8.edu/pablo/cigala https://code.up8.edu/pablo/cigala
- neetodavid 6y agoI built a shitty static site generator, too! I had no idea what I was doing. Didn't look at how other SSG's work... I just made some template HTML files, stuffed some content in YAML/Markdown frankenstein files, and then used JavaScript string.split().join() calls to stitch together the output files It worked! It is very satisfying to have one build command that generates the entire site and pushes it to gh-pages for hosting.
- jamessantiago 6y agoHey, what a coincidence. I've recently did some updates on my own shitty static site generator: https://santiagodevelopment.com https://santiagodevelopment.com In my case, I stuck with markdown and still used frontmatter to add metadata to posts. Since I'm using asp.net core, I can use the markdown library Markdig which supports frontmatter, but I can also just fallback to the name of the markdown file (regex out the date and title), since I don't need much information from metadata. Adding middleware to asp.net core is fairly easy as well, so I can simply create some simple middleware to create static files as requests come through. The only annoying case I had was how to manage syncing between git or gitlab (I created post retrieval clients for both) and already generated static files. I have a fairly forced method at the moment, where almost every generated file is wiped when a new git commit shows up, but I get to find those solutions myself since it's mine (!). Definitely agree with the sentiments here. Although, I feel that the fact there's already working products out there makes it less incentivized to do projects like this. The new programmers I know seem to be more interested in doing something new or creating software you can't just get from some SaaS. I guess when I created my first website I didn't have that worry, there was no squarespace or whatever else, so there was the double benefit of creating something both simple and new.
- pietroppeter 6y agoplot of "Number of blog posts" vs "Number of blog posts about elaborate blog setup": https://twitter.com/jxxf/status/1332839627170967554 https://twitter.com/jxxf/status/1332839627170967554
- cyrialize 6y agoI used to have my own and it was very... hacky. Basically it was a PHP website where there would be snippets of PHP at the top of the page followed by html with the occasional `<?php echo $var; ?>`. Then I wrote a simple bash script that curled the website from localhost and saved everything to a local folder (kind of like how Jekyll has _site). Then the script used the neocities gem [1] to automatically upload. I now use Jekyll, but I've thought about making my own because only I will use it and I'll understand it from top to bottom. With Jekyll whenever I need to make a change I have to re-read the docs to figure out what I need to do. [1]: https://github.com/neocities/neocities-ruby https://github.com/neocities/neocities-ruby
- johnnycarcin 6y agoWell I certainly never expected my project's name to conflict with another "shitty static site generator" haha. I ended up swapping "shitty" for "stupid" however: https://github.com/esell/sssg https://github.com/esell/sssg I started down the Go template route and quickly realized that pandoc + some other standard tools got me everything _I_ needed. It was a great learning experience for sure!
- T3RMINATED 6y agoif its chitty why did you build it? Gots time to waste?
- benibela 6y agoI wrote three The first one was some kind of macro processor to insert text in files. I do not remember the syntax, but in each file it was like: %headermacro% ...the content... %footer%. Then the macros were replaced by layout data, turning each file into a generated static page. Then I realized that is the wrong way around. All the content files had the same macros. It is very redundant. So I wrote a new one, that did it the other way around. Now there was a layout file with placeholders {{$WRITEX content/data}} and it would load the data from an XML content file and insert it in the layout file to generate the output file. And it had loops and conditions. Afair I could even write my "Makefile" in that language. Then I wrote a webscraper and implemented XPath 2, because nothing else supported that. Then XPath 2 is very close to XQuery, so I implemented that as well. Now XQuery is very similar to the second generator, but with a w3 standarized syntax. The above insert expression simply becomes {content/data}. So now I use the webscraper as site generator.
- kcartlidge 6y agoI use a few different languages to various levels of competence, and I always do a static site generator in each one as my sample project that lets me get a feel for their differences and strengths. So I currently have my own generators written in .Net Core, Go, Node, Python, Ruby, and PHP. Of them all, Go is by far the fastest, Node the simplest, .Net Core the cleanest, PHP the hackiest, Python the nicest, but Ruby the most balanced in all those areas. The Ruby one uses Markdown with YAML frontmatter, all in one script file that can be dropped directly into any folder and committed as part of my sites. If you're curious (and remember the Ruby one is not the best) you can see it in github at https://github.com/kcartlidge/ruthless https://github.com/kcartlidge/ruthless and running my site at https://kcartlidge.com https://kcartlidge.com (using Netlify).
- jagged-chisel 6y agoFor this exact purpose, I want a CLI-based template processor. Just a standalone template processor. They all seem to be buried in inside other frameworks or libraries: Smarty inside PHP (don't want to write a php-based CLI tool), Jinja2 is built for use by Python (I don't care to write python) ... I just want to call an engine with a template and an environment and get the final document out.