Meta tags in front matter

A feature request: I’d love to be able to set meta tags in blog posts (and pages I guess), maybe in the front-matter using something like

Meta image: pics.lol/some-image
Meta description: some description

Apologies if this is already possible using some custom templating and front-matter - if are there any docs on that?

You can add ad hoc variables in the front matter. The ones you named are probably safe. I used something like social image and social description and then you’d have to add this with the meta tags to your templates’ <head>. If you need to know what that would look like, let me know I can share mine.

2 Likes

Hi Annie - thanks for the info! I spent a while trying to figure out how to implement this and landed on the following solution, documented for future travellers:

In each blog post’s front matter add a Description item:

---
Date: 2023-12-09 11:01
Description: My Test Description
---

In your weblog template, add the variable:

<meta name="description" content={description} />

The next thing for me to figure out - how can I add the tag only if it is set? I naively tried

{description && <meta name="description" content={description} />}

to no avail.

Do you happen to know if the template system used by omg.lol is documented anywhere? Some searching hasn’t found it.

Unfortunately there are no conditional statements/logic in this template system, which I think is currently a custom rolled one. The way I got around this was to set a default in the front matter of a “default post” which is set in your config, so that at least there is always a value set even if you don’t change it.

Look in your config for something about “Posts” like in the following screenshot. I’ve brought up the idea of some logic, but I think that probably won’t happen until a “real” theming system gets implemented.

As for documentation, I think all that exists is the quick start guide: weblog.lol · weblog.lol quick start guide

2 Likes

Got it - thank you for the advice!