Hey, I’m trying to add a Mastodon profile verification link to my user profile pages:
You can verify yourself as the owner of the links in your profile metadata. For that, the linked website must contain a link back to your Mastodon profile. The link back must have a
rel="me" attribute. The text content of the link does not matter. Here is an example:
<a rel="me" href="https://mastodon.social/@BartV">Mastodon</a>
I noticed that the HTML version has the following section:
<img src='https://blenderartists.org/user_avatar/blenderartists.org/bartv/45/529382_2.png' alt='bartv' title='bartv' />
Is there a way to add a line with the required link to this section from a theme component?
Just add it to the footer, maybe. And if you don’t want it to show then you can add css to hide that div.
Ah, I didn’t explain myself well: users can enter their Mastodon URL as a custom field and I’d like to add a personal link for them to their own profile pages on my forum.
Basically you are suggesting that every site can verified all theirs users. So, because I have an account at mastodontti.fi I could add tags on my profile there and get verified.
Well… that is not exacly idea behind verification on Mastodon way.
Not really, all it says is that you’re also that person on another site, it doesn’t go beyond that. GitHub is preparing something similar.
But anyway, I’m not really here to debate this, just trying to find a solution to my question
No need to use CSS. It is just a link, so
<a rel="me" .. ></a> is enough.
You are missing the point. Then you could use what ever public Mastodon-server for that. And you are using quite wide definition of user of some site.
Yes you are because it dictates if your solution is right.
And it is. When there is empty or nill between opening and closing A-tag it works just fine, doesn’t show to visitors and doesnät need another CSS rule.
Sorry but it’s not. Take a look at the link under the Mastodon icon on my profile page here:
If you inspect the element, you’ll see the rel=“me” code, but if you view the page source, or load the page using wget or some tool like that, it’s not there as it’s generated client-side. A crawler won’t see that code.
I know I can add HTML to the page footer to verify just myself, but I want my users to be able to enter their Mastodon URL as a custom field, have it displayed on their profile pages and use that to verify themselves too.
To be sure we’re on the same page, are you trying to allow your users to verify themselves on Mastodon through your Discourse site by doing something similar to what’s outlined here: Get verified on Mastodon with your website | Opensource.com?
If so, maybe prompting users to add the link to either a regular post, or to their bio would work. Either of those would show up in the site’s crawler view. I don’t think it’s possible to override a crawler template from a theme component: Header Submenus - #134 by awesomerobot.
The issue I’m running into is that Discourse automatically strips the
rel="me" attribute from the links. Unless there’s a work around for that, the attribute might need to be added to the AllowLister via a plugin. I’m not up to speed on Discourse/Mastodon integration, but this might be something that’s useful for other sites.
Ah. That’s different.
I think if you have it set to display on the profile page (so that it’ll be available on the page) then you can get a theme component to add it at some plugin outlet, and then add some css to hide the default display of it.
That’s all I know without pulling up an editor and looking at existing code. But maybe it’s enough of a hint.
I did that, but the problem remains that (I think) Theme Components are always rendered client-side, and their output won’t be visible to crawlers. I’ll just park this idea for now, it’s breaking my brain