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

Add path, kind and lang to content front matter #11544

Closed
bep opened this issue Oct 8, 2023 · 1 comment
Closed

Add path, kind and lang to content front matter #11544

bep opened this issue Oct 8, 2023 · 1 comment

Comments

@bep
Copy link
Member

bep commented Oct 8, 2023

This relates to #11055 and #11540.

I'm planning on adding a canonical content path to Hugo, which is what you in Hugo 0.120.0 will get when you call .Path on Page.

For files, this will currently be determined from the file mounts + taxonomy setup, but a simple example may look like this:

content
├── _index.md
├── mysection
│   ├── _index.md
│   └── mybundle
│       ├── index.en.md
│       ├── index.jp.md
│       └── logo.png
└── p1.md

The path values the example above:

  • / = home page
  • /mysection
  • /mysection/mybundle (with 2 translations)
  • /mysection/mybundle/logo.png (a page resource)
  • /mysection/p1

If we want to load non-file resources into the above structure (e.g. pages from JSON files), the path will be the key. So I thought we could establish that now in the "front matter schema" sooner rather than later.

With #11055 we get a separation of Hugo configuration and user defined variables in front matter, so front matter could look something like this:

---
title: "My page"
path: "/mysection/mybundle"
lang: "no"
date: 2023-01-01
params:
   foo: bar
---

Hello **world**.

The above would add a third translation of the bundle. The above may not be very useful (what do I know), but we at least have a structure we can build on.

Note that we already have

  • url
  • translationKey

Which may look similar to path, but have very different semantics.

@bep bep added this to the v0.120.0 milestone Oct 8, 2023
@bep bep self-assigned this Oct 8, 2023
@bep bep pinned this issue Oct 8, 2023
@bep bep unpinned this issue Oct 9, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
@bep bep changed the title Add path and lang to content front matter Add path, kind and lang to content front matter Jan 29, 2024
bep added a commit to bep/hugo that referenced this issue Jan 29, 2024
* Note that none of these can be set via cascade.
* Also, you currently cannot use the `home` page kind.

Fixes gohugoio#11544
bep added a commit to bep/hugo that referenced this issue Jan 29, 2024
* Note that none of these can be set via cascade.
* Also, you currently cannot use the `home` page kind.

Fixes gohugoio#11544
bep added a commit to bep/hugo that referenced this issue Jan 30, 2024
Note that none of these can be set via cascade (you will get an error)

Fixes gohugoio#11544
bep added a commit to bep/hugo that referenced this issue Jan 30, 2024
Note that none of these can be set via cascade (you will get an error)

Fixes gohugoio#11544
@bep bep closed this as completed in f31a6db Jan 30, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant