Skip to content

Add partial decorators for better composability#692

Open
agriyakhetarpal wants to merge 10 commits intoscientific-python:mainfrom
agriyakhetarpal:partial-decorators
Open

Add partial decorators for better composability#692
agriyakhetarpal wants to merge 10 commits intoscientific-python:mainfrom
agriyakhetarpal:partial-decorators

Conversation

@agriyakhetarpal
Copy link
Member

@agriyakhetarpal agriyakhetarpal commented Dec 31, 2025

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 v0.154.5 v0.157.0 with this PR.

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 $card and .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.

@netlify
Copy link

netlify bot commented Dec 31, 2025

Deploy Preview for scientific-python-hugo-theme failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit a33e7e4
🔍 Latest deploy log https://app.netlify.com/projects/scientific-python-hugo-theme/deploys/69b1173b296bbf0008512ef8

@agriyakhetarpal agriyakhetarpal marked this pull request as draft December 31, 2025 23:14
@agriyakhetarpal agriyakhetarpal removed the request for review from stefanv December 31, 2025 23:14
@stefanv
Copy link
Member

stefanv commented Feb 9, 2026

I like the direction this is taking 👍

@stefanv
Copy link
Member

stefanv commented Feb 9, 2026

Also, it's neat that Hugo finally added that feature!

@stefanv
Copy link
Member

stefanv commented Feb 10, 2026

5:55:50 PM: ERROR error building site: render: [en v1.0.0 guest] failed to render pages: render of "/opt/build/repo/blog/content/posts/community-stories/will_tirone/index.md" failed: "/opt/build/scientific-python-hugo-theme/layouts/posts/single.html:2:3": execute of template failed: template: posts/single.html:2:3: executing "main" at <partial "posts/post.html" .>: error calling partial: "/opt/build/scientific-python-hugo-theme/layouts/partials/posts/post.html:3:10": execute of template failed: template: _partials/posts/post.html:3:10: executing "_partials/posts/post.html" at <partial "_decorators/content-container.html" .>: error calling partial: "/opt/build/scientific-python-hugo-theme/layouts/partials/_decorators/content-container.html:7:6": execute of template failed: template: _partials/_decorators/content-container.html:7:6: executing "_partials/_decorators/content-container.html" at <inner .>: error calling inner: template: _partials/posts/post.html:6:14: executing "_partials/_internal/decorator_8e9d3f7b5767b258" at <$featuredImage>: undefined variable: $featuredImage

@agriyakhetarpal agriyakhetarpal changed the title A start towards partial decorators for better composability Add partial decorators for better composability Mar 11, 2026
@agriyakhetarpal
Copy link
Member Author

agriyakhetarpal commented Mar 11, 2026

Restarting CI to see why Netlify is stuck

Edit: I'm just going to assume it is down, but will mark this as ready for review anyway.

@agriyakhetarpal agriyakhetarpal marked this pull request as ready for review March 11, 2026 07:20
@agriyakhetarpal agriyakhetarpal requested a review from stefanv March 11, 2026 07:20
@agriyakhetarpal agriyakhetarpal added this to the 0.23 milestone Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants