hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

[FEATURE] new opengraph 'fediverse:creator' meta

Open David-Guillot opened this issue 1 year ago • 1 comments
trafficstars

What does this PR change? What problem does it solve?

This PR adds support of this new Mastodon 4.3 feature for highlighting journalists and bloggers.

It does so by adding a new OpenGraph meta based on a new param which can be placed on a post or on the Hugo site.

Was the change discussed in an issue or in the Discussions before?

Closes #1618

PR Checklist

  • [ ] This change adds/updates translations and I have used the template present here.
  • [x] I have enabled maintainer edits for this PR.
  • [x] I have verified that the code works as described/as intended.
  • [ ] This change adds a Social Icon which has a permissive license to use it.
  • [x] This change does not include any CDN resources/links.
  • [x] This change does not include any unrelated scripts such as bash and python scripts.
  • [x] This change updates the overridden internal templates from HUGO's repository.

David-Guillot avatar Oct 17 '24 15:10 David-Guillot

Hi @David-Guillot I think its better if we add it to hugo's templates over here. https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html

cc @jmooring

adityatelange avatar Nov 08 '24 15:11 adityatelange

This would be another opinionated change to one of Hugo's embedded templates; I am not in favor of doing this. If it were up to me I would remove Hugo's embedded opengraph template (and others) from the code base.

jmooring avatar Nov 08 '24 15:11 jmooring

@adityatelange I think I agree with you: this theme is about styling a Hugo blog, not adding features that could apply to all Hugo bolgs. I just didn't think of opening a PR to @gohugoio/hugo .

@jmooring , are you saying that porting this PR to @gohugoio/hugo is a bad idea, because it would make Hugo too specific about what the web landscape is?

How do we move forward from here?

David-Guillot avatar Nov 08 '24 16:11 David-Guillot

I'm saying that this should be implemented at the theme or site level.

jmooring avatar Nov 08 '24 16:11 jmooring

I would remove Hugo's embedded opengraph template (and others) from the code base.

Think not of like a hugo author but a theme author. we have a feature dependency here with cover images which we cannot hot-plug into hugo's templates.

I had to overwrite embedded templates because we don't have a way to add hooks to these templates. If you have a better way of doing this please suggest. For hugo this is not a hurdle because the feature we are talking about is also a opinionated feature here.

adityatelange avatar Nov 08 '24 16:11 adityatelange

@David-Guillot

How do we move forward from here?

I see we also support multiple authors in meta tags, so in order to have this supported we'll not just need one name but a mapping of each authors fediverse id. Is it feasible? idk

adityatelange avatar Nov 08 '24 16:11 adityatelange

In my view many of the embedded templates are, at best, opinionated examples, and should be overwritten by theme authors to achieve the desired outcome.

Over the years I've examined thousands of sites, and I have seen all of the configuration constructs below:

[params]
fediverseCreator = 'foo'

[params.social]
fediverseCreator = 'foo'

[params.social.fediverse]
creator = 'foo'

[[params.social]]
id = 'fediverse'
creator = 'foo'

[[params.social.networks]]
id = 'fediverse'
creator = 'foo'

[[params.mytheme.social.networks]]
id = 'fediverse'
creator = 'foo'

Is one of these better than the others? No; it depends on what the site or theme author has in mind.

jmooring avatar Nov 08 '24 16:11 jmooring

but a mapping of each authors fediverse id

Yet another reason for handling this at the theme or site level.

jmooring avatar Nov 08 '24 16:11 jmooring

but a mapping of each authors fediverse id

Yet another reason for handling this at the theme or site level.

True

adityatelange avatar Nov 08 '24 17:11 adityatelange

I see we also support multiple authors in meta tags, so in order to have this supported we'll not just need one name but a mapping of each authors fediverse id. Is it feasible? idk

I'll try to figure that out next week. Meanwhile I'll convert this PR to draft. Thank you both for the discussion!

David-Guillot avatar Nov 08 '24 20:11 David-Guillot

@adityatelange for now, as you can see in The Technical section of Mastodon's announcement, multiple authors are not yet supported on their end.

So I just rebased this PR for now, let me know if you want to integrate this change as-is, in which case I'll set the PR ready for review.

David-Guillot avatar Nov 12 '24 09:11 David-Guillot

The mentioned article is from 2024-07-02 says:

If multiple tags are present on the page, the first one will be displayed, but we may add support for showing multiple authors in the future.

This is very vague and might be never. The following sentence about "coming weeks" is not about multiple authors but about the single creator attribution they just announced for Mastodon.

We intend to propose a specification draft for other ActivityPub platforms in the coming weeks.

I think there is no use on waiting for a new spec unless there is already a draft of the spec with multiple author attribution somewhere.

Syphdias avatar Dec 21 '24 23:12 Syphdias

@adityatelange what are your thoughts on this, two months later? I think @Syphdias is right: multiple authors are nowhere near landing on Mastodon. But many bloggers would benefit from this PR.

David-Guillot avatar Jan 06 '25 16:01 David-Guillot

All checks passed - time to implement?

joerglohrer avatar Feb 12 '25 15:02 joerglohrer

@adityatelange what are your thoughts on this, two months later? I think @Syphdias is right: multiple authors are nowhere near landing on Mastodon. But many bloggers would benefit from this PR.

Yes. #1642 looks much simpler patch to me. We can go ahead with this.

@jmooring would you be open to integrate #1642 to hugo's internal templates as well. Since we have fb:app_id and fb:admins which are also similar proprietary meta tags unrelated to opengraph protocol.

adityatelange avatar Mar 01 '25 07:03 adityatelange

Yeah I don't see much difference between #1642 and this one (this one just allows defining an author at site-level and one at post-level, which I thought was a good idea), but it you prefer #1642 let's go for it, because I really think this feature is a must-have for many users!

David-Guillot avatar Mar 01 '25 14:03 David-Guillot

Right that seems to be missing, I'll add something for that.

Looks like everywhere hugo is using global params only https://gohugo.io/templates/embedded/#open-graph

I think I'll extend twitter one in future. Let's go with this change first.

adityatelange avatar Mar 01 '25 14:03 adityatelange

Usage:

Site level:

params:
  social:
    fediverse_creator: "@[email protected]"

Page (Overrides Site level value):

---
title: "My Page"
social:
  fediverse_creator: "@[email protected]"
---

adityatelange avatar Mar 01 '25 15:03 adityatelange