Hacker News

8 days ago by nico_h

I have an 84 line bash script that abuses find, sed and multimarkdown to generate a website with a blog, static pages, navigation and rss feed for the blog. The index page has a header and the last 5 blog entries ((Navigation between the blog entries is plain old basic javascript).(https://github.com/nicolasH/frankensteins)

You don't have to be on the Node treadmill to create a static site generator. You can use something stable!

8 days ago by cxr

I notice that people who bring up shell scripts or makefiles in these types of discussions tend to tout the virtues of their setup based on those alone—putting undue focus on the glue layer, instead of the parts doing the heavy lifting—and this behavior strikes me as very odd.

Shell scripts are only as stable as the executables that they invoke (and portability is a separate matter worth taking into account, too—few people who mention stability address the issue of incompatible variations of shell and make across different systems). In this case, the upper bound is determined by peg-multimarkdown that you depend on.

8 days ago by Zababa

> You don't have to be on the Node treadmill to create a static site generator. You can use something stable!

Node isn't always a treadmill. JavaScript itself is very stable, much more than many other languages. The big thing you need is something to transform markdown to HTML. You can either write it yourself, or take one that's stable. The rest can be done in plain JS, without libraries.

8 days ago by p4bl0

I have my own too. It is a Makefile that makes extensive use of the core utils (sed!) and xml2 and 2xml to be able to process HTML using the line-oriented tools in the core-utils.

I also built a blog engine on top of git using sh scripts and the core-utils in git hooks (https://p4bl0.net/shebang/fugitive-readme.html), but that was a long time ago and I don't use it anymore. It had a dozen users at some point and I even received a few contributions to the project. Fun times :).

8 days ago by nico_h

It works by concatenating html files with some minimal replace. So it's easy to edit and update.

If it ever becomes too slow, maybe I look into using xargs -P or adding more '&' between commands.

8 days ago by marginalia_nu

I built a static site generator mostly because I wanted to dick around with some concepts in hypertext, like automatic backlinks and a very explicit filesystem metaphor.

I also primarily target the Gemini protocol, so the web presence is a bit of an afterthought and that probably shows as well. I deliberately included every limitation of gemtext into the HTML rendering of the documents, including no inline links and no inline images. It does do some special rendering but very little.

It's backed by a git repository with gemtext files that get rendered into HTML. There is also a gmi->gmi conversion for gemini, as I introduced a few non-standard tags to instruct the page generator to add stuff like generating feeds for the blog part and so on.

The result is weird and not at all intuitive. I also realized this is basically off-brand Confluence except not as hard to navigate and 1000 times faster.

But yeah, the main point is experimentation. Testing ideas and seeing what sticks. Some of it does, but not everything. Like I have no headers for my web sites. My thought was that it's just a part you scroll by, a piece of pointless self-promotion. I wanted to elevate the content above all else. Turns out it's pretty confusing when you do that. Books have a cover for a reason.

8 days ago by nathell

I built mine too, for similar reasons: it felt easier to write from scratch, so that my site looked the way I wanted it, than customize some of the existing solutions (Jekyll, Hugo, etc).

Sure it’s not customizable at all: it can only generate my site. And that’s fine. I like it that way.

For example: I sometimes translate poetry, and I have a bunch of code that renders individual poems from plaintext (not Markdown, because newlines and whitespace _are_ significant): https://github.com/nathell/nhp/blob/master/src/nhp/poems.clj

8 days ago by rawoke083600

I should preface I'm a solo-founder with a few side-projects(nothing big). Thus you have to usually make due with "just good enough" and move on to the other 10 tasks awaiting you.

My deploy script (it's just 5-10 lines of bash) mostly for some of my "old" angularjs(yes v1)

1) merge all js files (cat file.js >> app.js)

2) make sure any files that request/include JS and HTML files are not cached (generate new random ?rcc=random-num)

    find -type  f  | egrep  "html|js" | xargs sed -Ei s/"rcc=([0-9]+)"/rcc=$RANDOM/g

3) ssh-copy over to server

Sexy ? Absolutely not , does it work ? Like a dream :)

Having the ability to just type "./deploy-aws.sh" and be done in 5 sec is an amazing ability to have for you project. Especially if you are SOLO founder.

8 days ago by smackeyacky

Thought about using s3? I have static content I keep version controlled in github with a git hub action.

When I push to the production branch, a github action does an aws s3 sync. My web service pulls static content from the s3 bucket.

It works well and i really like github actions for this kind of work.

8 days ago by BillinghamJ

Perhaps you'd like to package your preprocessor into something to make Personal Home Pages...

8 days ago by pembrook

As evidenced by the comments in this post, developers love developing new static site generators.

Unfortunately, we typically lack the same enthusiasm for actually writing content for said static sites.

So you end up with 1,000,000 developer blogs with an average of 1 post.

The title of which is “how I built this blog using X”

After having gone through this charade many times myself (I’m a high level procrastinator), if your goal is to publish on the internet, do not spend time creating a custom static site generator.

In fact, don’t use a static site generator at all (you inevitably won’t remember how it works and will have broken dependencies years later when it comes time to pen post number 2).

Just sign up for a basic site builder (Webflow if it’s a company site, squarespace if it’s a personal blog), pick a not-offensive template, and be done with it.

Trust me, nobody will think less of you.

By eliminating the decision points around building something, you can force yourself to not waste hours comparing CSS frameworks and instead actually write something of value for other people.

8 days ago by marginalia_nu

So developers like developing stuff. Yeah that probably about sums it up.

I don't think that's an obstacle to writing. Let's be honest, the average blog lifetime is probably lasts less than a dozen posts. The ones that last are weird outliers, and that's not a problem from choosing the wrong technology.

8 days ago by pembrook

> I don't think that's an obstacle to writing.

It absolutely has been for me, and I'm willing to bet if you actually track your time, you might be surprised.

Obsessing over building is like a warm blanket for someone who's a developer by trade. Writing in public, by contrast, will make a non-writer extremely uncomfortable and vulnerable.

And humans are super good at pain-avoidance.

I spent roughly 200 hours trying to be clever about building my last blog (experimenting with static site generators, headless CMS options, markdown flavors, CSS frameworks, build process, etc) when I was first getting enamored with the static site world.

Fast forward a few years, it turns out I built a monster that I can't remember how to use, nor do I care to.

And I realized instead of getting my ideas into the world, I hid behind that security blanket of "building."

8 days ago by marginalia_nu

Well do you actually want to write? If you describe writing as a pain, maybe writing just isn't your jam.

Seems pretty common that people have a romanticized idea of writing, and like the idea of being a writer much more than they actually enjoy the writing process.

8 days ago by willvarfar

Been here, done that :) thx for a fun read :)

My most recent attempt to rekindle my old blog turned into a write-a-SSG-that-can-import-tumblr and then a quest to recapture the nostalgic MySpace/text-mode feel, and no actual new blog entries.

Writing an SSG was procrastination at its finest. I did manage to migrate to ghpages and make the old tumblr and google-sites versions auto-redirect.

8 days ago by laurent92

Yeah, on the other hand, my pro website is based on Jekyll and it doesn’t compile anymore because of version shenanigans…

8 days ago by willvarfar

Yeah I just checked and at least my SSG code is python3. That's a bit of a surprise to me, actually.

Its telling how, over the years, I've had to keep moving my free-hosted blog to a new provider. This is the third time. I'm hoping ghpages are here to stay and don't start doing a sourceforge ad angle or anything...

8 days ago by Santosh83

If only network connectivity had scaled up as remarkably as CPUs did over the years, we could all be hosting services from our home machines in true peer to peer manner. Distressingly though ISPs are reinforcing the client-server model by asymmetric bandwidth, blocking ports, forcing customers to purchase business plans for static addresses and so on. All technically unwarranted, purely user-hostile behaviour.

8 days ago by cabalamat

>I went on the Gatsby website, picked a theme, and went to work. And right away, the problem was clear: it was too much.

>Beyond all the extra stuff Gatsby ships with, a lot of Gatsby blog themes try to make things "easier" for you by abstracting away the internals and exposing a config.js file, where you add your name, a bio, some links, and Gatsby does the rest.

>But that comes at a cost. And that cost was made clear by me hunting the favicon file in the directory for a while only to find that some plugin auto-generated it based on a path for a profile photo you could set in the config.

Software design should adhere to the maxim: simple stuff should be simple, complex stuff should be possible.

When software adds so much complexity that simple stuff is no longer simple, it's time to revisit the design.

8 days ago by cozzyd

My website is constructed (and deployed) by a Makefile with a crappy find-and-replace script masquerading as a templating system. More or less this:

    all: $(addprefix $(OUTDIR)/, $(addsuffix .html, $(PAGES))) $(addprefix $(OUTDIR)/, $(notdir $(wildcard imgs/*)))  $(OUTDIR)/styles.css 

    $(OUTDIR)/%: imgs/% | $(OUTDIR)
        ln $< $@

    $(OUTDIR)/%.html: pages/%.page template | $(OUTDIR)
        $(BUILDER) template $< $@

    $(OUTDIR)/styles.css: styles.css
        ln $< $@ 

    deploy: 
       rsync -avh $(OUTDIR)/ $(DEST)

8 days ago by Tomte

Yes, but it gets tricky real quick.

You might want to have all html pages added to a <ul> in an index.html.

Then you might want a sitemap (similar solution to above).

Then you might want an RSS feed (and an atom feed).

Then you might want height and width attributes automatically set in <img> tags.

It's all doable, but soon your build script is a classic static site generator and dwarfs the Makefile in functionality and complexity.

8 days ago by cozzyd

Indeed, but that's overkill for most personal sites...

8 days ago by onion2k

That isn't really true. Adding things like image width and height attributes are basic essentials for any content drive website. If you push new content regularly then an RSS feed is very useful for visitors. If you want to be found in Google then you need a sitemap.

If you're not going to do the absolute minimum for your site's users why bother making a site in the first place?

8 days ago by deaddabe

What $(BUILDER) are you using? Could be GNU m4 (been there, done that) or something more (or less?) evolved.

8 days ago by cozzyd

Nothing fancy, just a python script that parses each page's "header" (a set of '='-delimited KVPs), interprets the rest as the main content, and then does some text substitution in the template (in practice, I only have a KVP for the page title that's used in the template).

8 days ago by lelanthran

Okay, you get nerd points for that.

I write my website in Emacs org mode, then export to html. I like to think that I win on nerd points :-)

8 days ago by na85

I tried that but couldn't grok how to set an arbitrary page structure. The default org html export is awful and it seems very opinionated about the workflow, but the docs weren't clear about what those opinions were.

Now I'm using a Frankenstein's monster of org-pandoc and `cat`

8 days ago by lelanthran

> I tried that but couldn't grok how to set an arbitrary page structure.

I don't know what this means - I write a normal org document with headings and suchlike, and then export. For site structure I store each page as a separate org file and the html-export exports the links correctly.

It might just be that I am happy with the output so I didn't try to change anything, so didn't run into the problem you did.

Daily digest email

Get a daily email with the the top stories from Hacker News. No spam, unsubscribe at any time.