Skip to content

[Feature]: Update front matter for page grouping, order, prev page and next page #81

@justinyoo

Description

@justinyoo

Background

For blog posts, if the UseDateInPostUrl option of SiteManifest is set to true, it can be easily places in order by date. However, for pages, there's no way for ordering rule except the alphabetical one.

In addition to that, some pages are closely related to each other so that they can be grouped together.

For example, let's say there are three pages like "Quickstart", "Setup" and "Themes". Both "Quickstart" and "Setup" are related, therefore they can be grouped as "Getting Started". However, logically the "Setup" page should come first before "Quickstart", but it's not currently possible when ordering pages because there's no way to set up the order explicitly. And the "Themes" page is not relevant to those two pages. Therefore, it should not be located under the same "Getting Started" section but should be placed in its own section.

Another finding on each page is that, if the front matter provides page lins for "prev" and "next", it would be much easier for readers to follow through the page with regards to page navigation.

For example, let's say there are three pages like "GitHub Pages", "Netlify" and "Azure" under the same "Publish" group. Each page describes how to publish ScissorHands.NET app to the designated platform. It's natural for the readers on the "GitHub Pages" page to see the next page of "Netlify", for the readers on the "Netlify" page to see the prev page of "GitHub Pages" and the next page of "Azure", and for the readers on the "Azure" page to see the prev page of "Netlify". If the front matter provides prev and next attributes, then these navigation would be much easier.

Describe the Feature

  • Introduce the section attribute to group pages in the front matter (ContentMetadata) so that pages having the same section value should be grouped together. The section should be nested by setting the section value to upper-section/lower-section.
  • Introduce the prev and next attributes in the front matter (ContentMetadata) so that the pages can display the previous page and the next page dynamically.

Here's the example of the front matter for "GitHub Pages"

---
title: GitHub Pages
slug: /docs/publish/github-pages
section: Publish
next:
  title: Netlify
  link: /docs/publish/netlify
  icon: right-arrow
---

Here's the example of the front matter for "Netlify"

---
title: Netlify
slug: /docs/publish/netlify
section: Publish
prev:
  title: GitHub Pages
  link: /docs/publish/github-pages
  icon: left-arrow
next:
  title: Azure
  link: /docs/publish/azure
  icon: right-arrow
---

And here's the example of the front matter for "Azure"

---
title: Azure
slug: /docs/publish/azure
section: Publish
prev:
  title: Netlify
  link: /docs/publish/netlify
  icon: left-arrow
---

In addition to that, in the contents/pages directory, there should be pages.json file that defines the sections and pages order and hierarchy like:

// pages.json
{
  "pages": [
    { "section": "Getting Started", "page": "Setup" },
    { "section": "Getting Started", "page": "Quickstart" },
    { "section": "Publish", "page": "GitHub Pages" },
    { "section": "Publish", "page": "Netlify" },
    { "section": "Publish", "page": "Azure" }
  ]
}

Alternatives Considered

No response

Screenshots

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions