Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize pages using IDs #1409

Open
dluc opened this issue Jan 3, 2024 · 1 comment
Open

Organize pages using IDs #1409

dluc opened this issue Jan 3, 2024 · 1 comment

Comments

@dluc
Copy link

dluc commented Jan 3, 2024

I'm writing a set of documentation pages organized on 3 levels, and often I need to rename titles or move pages from a top level to some nested level, and viceversa.

There are a few operations that are quite tedious and error prone:

  1. when changing a page title in one file, all children and grandchildren are affected, e.g. all links are broken and require editing an entire tree of pages
  2. when moving a page from top level under another page, all children/grandchildren are affected and need editing (plus there's a limit of 3 levels, so it's not always possible)

Overall, the main issue I think is relying on Page Title for organizing content, while it could be much easier having a dedicated Page ID and linking pages by ID. That's also how most CMS work and it would bring some benefits:

  1. No need for grand_parent
  2. Editing pages and Linking pages operations would not affecting each other
  3. Allow to reuse Page ID values from a DB (e.g. GUIDs), e.g. if the content is managed with some software
  4. Unlimited levels without the need to introduce something like grand_grand_grand_...._parent
  5. No need for has_children (this could already be removed IMO)
  6. permalinks could be auto-generated using the ID, e.g. /pages/<page ID>

Example with 3 pages
Current:

---
title: Home
has_children: true
permalink: /
---
---
title: About
parent: Home
has_children: true
permalink: /about
---
---
title: Contact US
parent: About
grand_parent: Home
permalink: /about/contact-us
---

Proposal:

---
title: Home
id: 1
permalink: /
---
---
title: About
id: 123abc
parent: 1
permalink: /about
---
---
title: Contact US
id: 99b
parent: 123abc
permalink: /about/contact-us
---
@pdmosses
Copy link
Contributor

There are a few operations that are quite tedious and error prone:

Right.

Overall, the main issue I think is relying on Page Title for organizing content, while it could be much easier having a dedicated Page ID and linking pages by ID. That's also how most CMS work and it would bring some benefits:

Switching to use page IDs for linking pages also has some significant drawbacks:

  1. Requiring the use of page IDs would probably break almost all existing sites that use the theme.
  2. Migrating a large site to use manually-chosen page IDs would surely be extremely tedious.
  3. Ensuring site-wide uniqueness of page IDs could be problematic.

This theme generally tries to minimise breaking changes, so that existing sites can easily be upgraded to new releases and take advantage of the new features. Switching to require page IDs for linking pages would be a major breaking change.

Moreover, the source files of many websites may be organised systematically in much the same way as the navigation: the source files of pages with different parent pages are naturally stored in different directories. For such websites, the path to a source file is inherently a unique ID, and links between pages could be based directly on their paths – eliminating the need for parent, has_children, and grand_parent fields, as well as supporting unlimited navigation levels (see my comment in a discussion).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants