Trying to let users add Mastodon verification links, need some help

Hey, I’m trying to add a Mastodon profile verification link to my user profile pages:

Verification

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 have forked the Clickable Social Icon Links on Profile TC and it displays the Mastodon link fine on the user profile pages, but since it renders as a handlebars template, it’s not visible in the ‘html/no javascript’ version and the Mastodon crawler won’t see it.

I noticed that the HTML version has the following section:

<div class="user-crawler">
<img src='https://blenderartists.org/user_avatar/blenderartists.org/bartv/45/529382_2.png' alt='bartv' title='bartv' />
<h2 class='username'>bartv</h2>

Is there a way to add a line with the required link to this section from a theme component?

2 Likes

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.

1 Like

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 :slight_smile:

No need to use CSS. It is just a link, so <a rel="me" .. ></a> is enough.

The thing

Yes, but it needs to be accessible to a crawler. Ember/Handlebars scripts won’t work as they’re rendered by Javascript.

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:

image

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.

If you say so…

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.

2 Likes

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.

1 Like

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 :slight_smile:

Oh! Sorry. I couldn’t pay attention to all of this at one time. Yeah. You’ll need the plugin to add it to the non javascript version, so you’ll need to override the rails template, I guess.

1 Like