Skip to content

feat: support author avatar (photo)#1030

Open
kiannidev wants to merge 3 commits intodillonzq:masterfrom
kiannidev:feat/author-avatar
Open

feat: support author avatar (photo)#1030
kiannidev wants to merge 3 commits intodillonzq:masterfrom
kiannidev:feat/author-avatar

Conversation

@kiannidev
Copy link
Copy Markdown
Contributor

@kiannidev kiannidev commented Mar 10, 2026

Summary

  • Add support for displaying an author avatar (photo) next to the author name in post meta for single posts and post summaries.
  • Reuse the existing h-card/person markup to render avatars, with graceful fallback to the previous user icon when no avatar is configured.
  • Expose new configuration fields for a global author avatar and optional per-post override, and wire the avatar into the structured data author object for better SEO.

Fixes #977

Implementation details

  • Introduce params.author.avatar in the theme config, and support authorAvatar in page front matter to override per post.
  • Update layouts/posts/single.html and layouts/summary.html to render the author via the existing plugin/h-card partial, passing the avatar URL when available.
  • Extend layouts/_partials/head/seo.html so the JSON-LD author object includes an image field resolving the avatar as a Hugo resource or absolute URL.
  • Update exampleSite/hugo.toml to demonstrate configuring an avatar path so reviewers can see the behavior quickly when running the example site.

Usage

  • Set a global avatar in site params, for example:
    • [params.author]avatar = "/images/avatar.png"
  • Optionally override per post using front matter:
    • authorAvatar: "/images/specific-author.png"
root added 2 commits March 10, 2026 01:08
Add params.security.contentSecurityPolicy option to output CSP via meta tag
when HTTP headers cannot be set (e.g. static hosting).

Usage in hugo.toml:
  [params.security]
    contentSecurityPolicy = "default-src 'self'"

Ref: https://content-security-policy.com/examples/meta/
Add configurable author avatar support in post meta for single posts and summaries, reusing existing h-card/person styles and wiring avatar into SEO metadata.

Made-with: Cursor
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 10, 2026

Deploy Preview for hugo-loveit ready!

Name Link
🔨 Latest commit f01b2ac
🔍 Latest deploy log https://app.netlify.com/projects/hugo-loveit/deploys/69b17585eeafb500089202e9
😎 Deploy Preview https://deploy-preview-1030--hugo-loveit.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100
Accessibility: 98
Best Practices: 100
SEO: 82
PWA: 78
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@kiannidev
Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
I created this PR first.
I will do the additional requirements in previous PR after completing this PR

Thanks

Copy link
Copy Markdown
Owner

@dillonzq dillonzq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image There seems to be a problem with the style, the size of the avatar is too large
Adjust post meta avatar styling so the author photo renders as a small inline avatar next to the name instead of appearing too large.

Made-with: Cursor
@kiannidev kiannidev requested a review from dillonzq March 11, 2026 14:37
@kiannidev
Copy link
Copy Markdown
Contributor Author

image Sorry, I forgot to push css file.
@kiannidev
Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
Please review this PR so that i can continue to work on your preview requirement.

Thanks

@kiannidev
Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
Could you review this PR?

Thanks

@kiannidev
Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
Can you check this PR please?

@kiannidev
Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
Please review this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants