Skip to content

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

@henrypham67

Description

@henrypham67

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:

{{/* 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

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.

Suggested Hook Locations

Hook partial Position
layouts/partials/extend_post_content.html After content, before footer

Impact

Zero breaking changes — existing sites unaffected. Eliminates the most common reason users override single.html

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions