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

order of fields in defaultContext #1030

Closed
tanyabouman opened this issue May 14, 2024 · 3 comments
Closed

order of fields in defaultContext #1030

tanyabouman opened this issue May 14, 2024 · 3 comments

Comments

@tanyabouman
Copy link
Contributor

The defaultContext makes several fields available in addition to the metadata fields. These extra fields are path, url, title, and body. The body field is always its default definition, but the others can be replaced by the metadata fields of the same name.

Replacing the default title makes sense, and the example site does that. However, I don't know any use cases for changing the value of path or url, and I can easily imagine that accidentally replacing their value could cause broken links.

Would it be an improvement to change the order of the fields in defaultContext so that path and url are not replaceable in the metadata?

@Minoru
Copy link
Collaborator

Minoru commented May 14, 2024

I don't know offhand how these fields are used internally, so can't comment on how dangerous it is to change them.

However, I often find that something that can be done is done by someone, so taking it away breaks their setup. For Hakyll, I sometimes search for "site.hs" on GitHub (thus identifying Hakyll users), and then grep those repos for the bit I'm interested in (something like "^path: " in this case). I'm suggesting you do that to see if someone is (ab)using these meta-fields currently.

@chungyc
Copy link
Contributor

chungyc commented May 14, 2024

If one does not want the URL to be the straightforward path-based URL, e.g., if one wants clean URLs, then changing the url field makes sense. For example, see https://chungyc.org/article/technical/website/extensionless#directory-urls.

I don't know of any good reason to change the path field, but neither do I know of a good reason to prevent changing it.

@tanyabouman
Copy link
Contributor Author

Thanks for the information! I'll close the issue because the current state seems good.

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

No branches or pull requests

3 participants