-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Work in progress: Externalized page metadata #5455
Comments
Great vision for the future here! :) |
This is cool. My brain wants to do
Or is that a bridge too far? |
I think we'll eventually need template functions and context like @moorereason suggests here when we need to assign value to pages built from external data source:
|
My brain wants to do that, too. And we will eventually get there, but I'm not sure "Go templates" is the correct medicine -- as they are basically text templates (e.g. presentational), and also not very fast. See https://discourse.gohugo.io/t/tools-libraries-that-can-drive-new-hugo-features/7891/48?u=bep |
OK, so I suspect the above would be highly ineffective at scale. But, it got me thinking a little.
The The above would probably only work for TOML? I.e. the multiline stuff. But it would be pretty flexible, a. Note that the field names above are very temporary ( |
The script value could ideally be stored in a separate file to improve coder's experience. Or better yet one of those new custom function being discussed.(#5222). The
I'm really bad at writing toml. |
Dood. I missed to golua library. Hugo+Lua would be very interesting. I’ll have to ponder the implications. |
But looking at the above attempts of "scripting in config" looks ... ugly. We risk ending up ... https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab-ci.yml |
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
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. |
This issue describes a way to add or modify
Page
metadata in batches from external file(s). This is the information you currently only set inPage
front matter.Some use cases:
ByWeight
(with fall back to date and then title). Setting weight in front matter to get a particular order can be cumbersome if you have thousands of articles. With this implemented, you can re-arrange the pages by assigningweight
in batches by Glob pattern matching.funny
andcat
in the path with the tagFunny Cats
Other
to pages with no category set.Some examples in
TOML
:meta
definitions, and all pages will be tested against all of them.match
andmatchFirst
will be assigned the given metadata. ifreplace = true
any existing value will be replaced.match
pattern is primarily "motivated by speed", but it also allows for simple and coarse-grained patterns inmatchFirst
.meta.data
map directly to what you would normally set in page front matter.matchFirst
sets the order of the 1-based:counter
placeholder. In the example above, the articles aboutdog
will getweight
10, 20, 30, and then come the cats and finally all the other.matchFirst
is a multiline string, but we will accept string arrays, too.We will match against the
canonical path
* (always prefixed by the current language, so one can do/{en,jp}/blog/**
etc).*
: It would be tempting to match against.RelPermalink
, but that will typically change across languages. We need to define the termcanonical path
as part of this issue.Some references:
The text was updated successfully, but these errors were encountered: