Don't write pages to disk in Pelican

With Eleventy[1], you can set

permalink: false

in the metadata of a page (the stuff right at the beginning of a page) to prevent the page from being written to disk.

Why would you want this? One reason is that you have a one-page website where different topic pages like "our mission", "what we provide" etc. should only be included into the index page, so they can be viewed there, but pages should not be written to disk as separate HTML files.

Here’s how to do that in Pelican: Just set

 :status: skip

in your metadata.

Note

If you look quite sharply at the code example above, you will recognize that the line is indented a bit more than usual. Why? Well, if you just write :status: skip at the start of the line, it will be read as attribute and this page will be skipped. Makes your head spin, doesn’t it?

I already described that phenomenon here.

This feature is brand-new, it works with Pelican 4.10.1, but not yet with Pelican 4.9.1.

This also works (by accident) with Pelican 4.9.1, but only because Pelican says[2]:

I don’t know what :status: skip means, so I will skip the page.

Here’s the documentation (in section Skip Posts): https://docs.getpelican.com/en/latest/content.html.

If you look closely, you’ll recognize that this example is using Asciidoc. You can tell that from the way the metadata are written, with one leading and one trailing colon. The whole skip feature should work with other text formats, like HTML or your favorite kind of Markdown, without a problem, but I never tried that because I’m an Asciidoc fanboy and hardly use any other text format for my stuff.


1. A really nice static website generator, written in JavaScript, see https://www.11ty.dev/
2. Ok, Pelican says it in a more technical voice, I made it a bit more prose-like.

links

social