Add partial decorators for better composability#692
Add partial decorators for better composability#692agriyakhetarpal wants to merge 13 commits intoscientific-python:mainfrom
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
|
|
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. |
|
Needs Authors update |
|
The atom feed template uses |
|
We can switch to yelosan/hugo-feeds on Codeberg. It looks like it's a bit better maintained (but still not maintained well enough, though). See yelosan/hugo-feeds (GitHub mirror) too. Another one I found is https://github.com/hugo-fixit/hugo-atom-feed, which last worked with Hugo v0.146.7. Honestly, I'm tempted to drop it, but reading #489 and #497, I see that we did have a fork of this subtheme in the past. |
|
How about we submit a patch first and see if it gets accepted? |
|
(We can merge, using a fork of our own for now.) |
|
I can open up a PR tomorrow evening, sure. I won't suggest using a fork of the theme for merging this PR, though, because the change isn't that substantial – I only copied the file into diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml
index 3e610c3..40005d1 100644
--- a/layouts/_default/list.atom.xml
+++ b/layouts/_default/list.atom.xml
@@ -50,14 +50,16 @@
<logo>{{ (. | fingerprint).Permalink }}</logo>
{{- end }}
{{ end }}
- {{ with site.Author.name -}}
- <author>
- <name>{{ . }}</name>
- {{ with site.Author.email }}
- <email>{{ . }}</email>
- {{ end -}}
- </author>
- {{- end }}
+ {{ with site.Params.author }}
+ {{ with .name -}}
+ <author>
+ <name>{{ . }}</name>
+ {{ with $.Site.Params.author.email }}
+ <email>{{ . }}</email>
+ {{ end -}}
+ </author>
+ {{- end }}
+ {{ end }}
{{ with site.Params.id }}
<id>{{ . | plainify }}</id>
{{ else }}
@@ -92,8 +94,8 @@
{{ else }}
<id>{{ .Permalink }}</id>
{{ end }}
- {{ with .Params.author -}}
- {{- range . -}} <!-- Assuming the author front-matter to be a list -->
+ {{ with .Params.authors -}}
+ {{- range . -}}
<author>
<name>{{ . }}</name>
</author>
I can note these changed hunks in a comment if you'd like me to, but a fork is pretty overkill 😅 |

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.5v0.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
$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.