Add partial decorators for better composability - #692
Conversation
✅ Deploy Preview for scientific-python-hugo-theme ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I like the direction this is taking 👍 |
|
Also, it's neat that Hugo finally added that feature! |
efe5001 to
3d75b62
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
I spent some time thinking about what can be done here, since the author of the Atom feed is unresponsive to PRs (and that is unfortunate as is). I think I have a solution, which is simply that we just shouldn't bump to Hugo 0.157.0 here – we should only bump to Hugo 0.155.0, and that will allow us to have a cleaner separation of concerns. This way, this PR can now be merged without messing with the Atom feed theme. That theme being broken is a consequence of upgrading to Hugo 0.156.0 and later, which removed the |
|
Could you PTAL now, @stefanv? The diff is much smaller, and the PR should be far easier to digest! |

This PR introduces partial decorators, a new feature in Hugo released with v0.154.0: https://github.com/gohugoio/hugo/releases/tag/v0.154.0. This will not be a user-facing change. The documentation is at https://gohugo.io/functions/templates/inner/ and is currently a bit sparse, but still understandable. From the docs: I have bumped to Hugo 0.155.0 with this PR, which is as far as we can go right now.
A partial decorator is a partial template called from any other template including shortcodes, render hooks, and other partials.
There are some more examples here: gohugoio/hugoDocs#3330.
I also tried to add something to deduplicate the grid of items and cards, but that turned out to be more complicated – the content inside needs access to outer variables such as
$cardand.body. I think we can go ahead with this, for now at least, since it's a net win for easy deduplication either way, and we can do this kind of work incrementally.