So let’s say you are new to Mastodon, and you want to “verify” one of the links you’ve attached to your profile so that people know that you are you. Furthermore, let’s say you are running a WordPress site.  This blog post will show you how to “link” the WP site back to Mastodon to prove that you are the owner of said website.

 

NOTE: DO NOT ADD THE WEBSITE HTTPS URL IN YOUR MASTODON PROFILE UNTIL YOU HAVE COMPLETED EVERYTHING ELSE ON THIS PAGE

First, grab the “verification” link from Mastodon.  You can find this in your ‘Edit Profile’ options.  It will look something like this:

<a rel=”me” href=”https://mstdn.social/@jessicakelly”>Mastodon</a> 

There are two parts that you really have to understand here.  The href attribute points to a URL.  The first thing is that you would replace mstdn.social with the instance your account is on and then secondly, change the account username from jessicakelly to yourUserName, whatever that may be.

Once you have this bit of HTML, we can proceed to the next step.

We are going to talk about landing/home/index pages now.  An index page is basically the url with nothing after the domain in the url.  So for instance, this website’s index page would be https://jessicabkelly.com .  Note how NOTHING follows .com.  So placing the verification HTML info in a page other than the landing page will probably not work, unless that is explicitly what is linked to from Mastodon.

You need to identify which WP “page” is the index page.  For me, it’s the one I’ve called “Home” as seen in the next picture.  Now, I have some extensions installed, but we are looking at the “Pages” view from your WP-admin screen.

Now that you’ve identified the page that is the index page, click on the link (“Home” in my example) and you’ll be taken to the page editor.

You’ll see a “live” view of the page with any visual edits you’ve made.  You will also notice a “Text” tab as denoted in the middle-right of the screenshot below.  That will give you the HTML view of the page.  Go ahead and click that.  AT THIS POINT YOU SHOULD HAVE BACKED UP YOUR SITE JUST IN CASE OF ERRORS IN THE HTML THAT WOULD BREAK RENDERING, although if you have your WP login url bookmarked, you can probably probably get back in here to take out any bad changes.

Go to a spot in the HTML where you want to insert your verification tag.  This will display a link on your page, so I’d recommend the top or the bottom of your page, somewhere where it won’t break the flow of your page but it will still be present.  Of course, you can stick it anywhere “HTML-legal” from what I can tell.  In my example, I stuck it in a paragraph set of tags so that it will render along with any formatting my CSS uses for that tag.

Ok, now if you go back to Mastodon, you should see that your link has been upgraded as seen below!  Congrats, you have proved ownership of your site and have demonstrated you are you~

 

Edit (November 7, 2022):  A user pointed out that this may not work for all wordpress plans/instances, so they’ve helpfully added the following additional solution:

So it turns out, at least when I tried, that adding the verification HTML just anywhere on the page doesn’t work; for some reason, WordPress removes the “rel” property when it serves the page.

(Maybe I’m not paying them enough per month to be able to use random properties!)

But I used the “New Link” function to add a Mastodon link, and in the New Link dialog there’s a place to say what kind of relationship the link it, and there’s a choice like “another website of mine”, and when you check that it adds the rel property with value “me noopener” which okay I guess, and apparently that is enough for Mastodon, and yay!

Thanks for posting this, and if your experience matches mine, you might want to update it to suggest the New Link trick.

 

10 thoughts on “Adding a “Verified” Website running WordPress to Mastodon

  1. So it turns out, at least when I tried, that adding the verification HTML just anywhere on the page doesn’t work; for some reason, WordPress removes the “rel” property when it serves the page.

    (Maybe I’m not paying them enough per month to be able to use random properties!)

    But I used the “New Link” function to add a Mastodon link, and in the New Link dialog there’s a place to say what kind of relationship the link it, and there’s a choice like “another website of mine”, and when you check that it adds the rel property with value “me noopener” which okay I guess, and apparently that is enough for Mastodon, and yay!

    Thanks for posting this, and if your experience matches mine, you might want to update it to suggest the New Link trick.

    • So I recently changed instances and actually need to re-verify ownership of this site over on mastodon. Let me see if my original steps still work, but I will add your commentary to the current post as it may help others in either case.

      Thanks for sharing!

  2. Thanks for this.
    How long does it take until the verification appears in Mastodon? I just edited the functions.php file in my WordPress theme, but not sure it’s working. Code shows the snippet, but I am clueless. Thanks.

    • I experimented and it looks like the hook to verify ownership is fired when you first create the profile entry over on mastodon. So if you delete the profile entry for your site and re-add, it should work.

    • So for another site I run, I did have to go the widget route, as the main page wasn’t accessible directly within the dashboard, as it didn’t serve static content.

      If you go into your widgets, find the one corresponding to a footer, use the ‘Custom HTML’ block to put in the snippet of code, and then you can go to your Mastodon profile and enter in the site, https included, into the free-form data table section of your profile.

      By virtue of being the footer, the index url should work, e.g. https://heavymusic.rocks

      • I added it to the sidebar and it links successfully to my Mastodon profile, but I don’t understand what you mean by ‘free form data table section.” I entered my site’s URL into the bio section, but that must not be it because I don’t get your green verification.

        • So in my version of the masto UI at least, there is a section, below the bio while in edit mode, that says ‘profile metadata.’ In the left column, give a couple word description of the link that goes into the right column. Once you’ve done that and saved, the verification logic should fire.

          • And there it was, right next to the “verification” part that we started with. I had seen that “profile metadata” area, but didn’t twig. Now it’s just a matter of getting that green arrow. And there it is. Thank you, Jessica.

            rjb

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>