[SPEC] Backwards-compatible metadata in Gemini

Oliver Simmons oliversimmo at gmail.com
Mon Feb 22 00:46:22 GMT 2021


On Sun, 21 Feb 2021 at 20:21, easrng <easrng at gmail.com> wrote:
>
> Many of us strongly believe in the one pageload generates one request philosophy, including me, but metadata is also nice to have. While you could put metadata in other files, that would result in multiple requests being made. Instead, I am proposing a new file format, text/gemini-metadata+json, to be used in data URIs in Gemtext. It would be json (simply because it is popular and has wide support) with specified keys. Possible things to include in the metadata could be a favicon (be it emoji or otherwise), a theme color or color scheme to be used by the client as it wishes, etc.
> It would be used like this:
>
> ```
> # My super cool gemsite
> Welcome!
>
> => data:text/gemini-metadata+json;charset=utf-8,{"favicon":"%E2%80%8D"} Page metadata
> ```
>
> A Gemini client implementing this would add a check for links starting with data:text/gemini-metadata+json to it's rendering code and when it encounters one, decode it and take note of the metadata. Clients not implenenting it will just see a link to the data, degrading (imo) quite gracefully. I can't decide if the link should be hidden or not in browsers with support though. If the link is hidden then the client should make sure to expose the metadata elsewhere in the interface.
> Please give all the feedback!
>

Whilst it does fallback gracefully, I think the method of putting it
in a link is a bit "hack-y" and using the data: URI may pave the way
for other things abusing it.
Also for people that don't have nice link parsing it would look a mess.

I think something like this would be nicer:
```
# Boop, a website :)
Free hugs for all!

^^^
favicon: 🤗
author: Bob McBobface
last-edited: 22nd Feb 2021
```

That is:
```
<PAGE>
^^^
<METADATA>
```

For the metadata format I think a simple key:value list would work
fine, nothing overcomplicated.
To someone without support for it it should just look like a human
list of metadata.

This way it would work with gemtext's current line-by-line method, and
parsing should be simple.
The delimiter would work similar to the opening ``` toggle and there
would be no closing one, enforcing placing it at the end of the file.
The delimiter needs to be 3 chars long (as per current spec), and
something people wouldn't want to use in their document elsewhere, I
think ^^^ would work good for this.

I think this is given, but the metadata would be entirely optional.

- Oliver Simmons (GoodClover)


More information about the Gemini mailing list