svandragt / lamb

Literally Another Micro Blog
https://github.com/svandragt/lamb/wiki
MIT License
6 stars 0 forks source link

Post title has incorrect heading level #85

Open svandragt opened 3 days ago

svandragt commented 3 days ago

Bad for SEO and accessibility, when there's not exactly one h1.

Example content:

---
title: hey boy
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

## Subheading (2/3)

More lorem

Expected:

  1. On the homepage: the index title (site title) is h1, posts are h2, and subheadings are h3 and below
  2. On single pages: the post title is h1, subheadings are h2 and below.
  3. Conflicting this: markdown renders to absolute headings not relative.

Actual:

  1. same
  2. On single pages: the post is h2, subheadings are h3 and below, there is no h1
  3. markdown integrity is preserved.

To satisfy this, It might mean we have to assume ## is a subheading. and ### is a subsubheading.

svandragt commented 3 days ago

If we can pass in the relative top heading level into the render function, then adjust the markdown by increasing the heading level as required, then render the post.