gbdev / gbdev/pandocs

Set meta description per-page

Open
#393 3 comments 1 reaction 0 assignees View on GitHub
enhancement frontend
Dominant language
Markdown
Stars
783
Forks
134
Avg merge
6h 54m
Merged PRs (30d)
3

Description

Currently, the description meta tag is set to a site-wide value, on every single exported HTML page:

```

```

We need a proper couple of sentences, different for each page, to actually showcase what the page is about.

A couple of possible solutions:
- Set description manually, per-page. This is the best as we can prepare curated "extracts". I'd like to be able to set it per-markdown file, maybe in a YAML front matter. See https://docs.rs/mdbook-frontmatter/0.0.4/mdbook_frontmatter/ can be useful
- Unstrip the `{{{ content }}}` value of the HTML, ignore the headers and consider the first N (30, 40?) characters. Maybe even try to detect the first M (2, 3?) sentences.

Example of a Twitter generated card for a page in Pan Docs after this modifications:

![image](https://user-images.githubusercontent.com/14352721/148852015-a310ad5f-05f3-456a-88c7-1ee1888bf2cf.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.