ITADN

[Enhancement]: partial injection hooks in single.html to avoid full layout overrides

#1845Openhenrypham67 创建于 2026-03-14
enhancement
H
henrypham67commented
### What you'd like to propose? ## Problem I need to inject custom content into `single.html` (e.g., after post content, before the footer), the only option that I have is to copy the entire `layouts/_default/single.html` into their project and maintain it as an override. This creates a maintenance burden: every time PaperMod updates `single.html`, I have to manually diff and re-apply their customizations — or risk falling behind on upstream improvements. ## Proposed Solution Add no-op hook partials at key injection points in `single.html` that users can override in their own `layouts/partials/` without touching the base layout. **Example hooks in `single.html`:** ```html {{/* Hook: users override this partial to inject content after post body */}} {{- partial "extend_post_content.html" . }} ``` Ship them as empty stubs in PaperMod: ``` layouts/partials/extend_post_content.html → empty layouts/partials/extend_post_footer.html → empty ``` ## Real-World Use Case I maintain a quiz and flashcard system. I inject two partials after the post body, but must override the full `single.html` to do so. With an `extend_post_content.html` hook, I could drop the layout override entirely. ## Prior Art - **Hugo Bootstrap Theme** ships `layouts/partials/hooks/` stubs - **Blowfish theme** uses `layouts/partials/extend_*.html` conventions ## Suggested Hook Locations | Hook partial | Position | |---|---| | `extend_head.html` | Inside `<head>` | | `extend_post_header.html` | After post header | | `extend_post_content.html` | After content, before footer | | `extend_post_footer.html` | After footer | | `extend_article.html` | After `</article>` | ## Impact Zero breaking changes — existing sites unaffected. Eliminates the most common reason users override `single.html` ### Code of Conduct - [x] I agree to follow this project's Code of Conduct
0 条评论