• Resolved elliekennard

    (@elliekennard)


    Hi there, first, thank you so much for creating this plugin.

    I have just installed the plugin and created a test post which worked fine in that the title and a link to the post appeared in Mastodon.

    I would have liked to have the post text also appear on Mastodon. Is that possible? How would I do that?

    And how do I include hashtags in my posts?

    I am sure this won’t be possible, but in the old Google+ days, the plugin which behaved similarly also ported the comments from G+ to the blog. I suppose that’s too much to hope for…?

    I will try an image post next, but wanted to get this sorted first.

    Cheers

    Ellie

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter elliekennard

    (@elliekennard)

    I worked it out, so sorry to have posted. I think it will do exactly what I want, though the comments on Mastodon can’t come back to my blog, I guess.

    Cheers

    Plugin Author Jan Boddez

    (@janboddez)

    Hi Ellie, glad to hear you got it working.

    Just to recap/for others that may see this, it is possible to set up a custom “template” over on the Share on Mastodon settings page, and use the %title%, %excerpt%, %permalink%, and %tags% “template tags.”

    In the case of shortish, mostly plain-text posts, %excerpt% might be enough for your needs. If needed, a bit of custom code (like, one line) can be added to make this “excerpt” a bit longer (although if the overall message, including hashtags and so on, becomes too long, your Mastodon instance will reject it) and include more of the post text.

    There’s also an extra option to tweak this same template but on a per-post basis. (Like, in case you ever don’t want to include the title or permalink or something.)

    If that doesn’t do and you’re not afraid of a little PHP (the programming language WordPress is written in), please have a look at https://jan.boddez.net/wordpress/share-on-mastodon#share_on_mastodon_status, as it is possible to customize Mastodon statuses even more, programmatically. There’s a few more examples floating around the web, let me know if you need some pointers.

    Plugin Author Jan Boddez

    (@janboddez)

    As for importing comments into WordPress, there are several options:

    • A first is to look into “Webmention.” There’s a Webmention plugin that lets other sites “ping” your blog when they mention or “reply” to it. And while Mastodon itself does not send out these webmentions, it is possible to use a free service called Bridgy. Bridgy does send webmentions (and, thus, comments) to your site whenever someone replies to one of your crossposted (i.e., to Mastodon) posts. (I think it may be able to share posts to Mastodon as well, similar to what this plugin does, but it might not be as configurable.) This is what I currently use on my blog (well, except I use a plugin called IndieBlocks rather than the Webmention plugin); an example result would be the different reactions on this page: https://jan.boddez.net/articles/share-on-mastodon-v0-17-0.
    • Another is to instead explore “native” ActivityPub, which means turning your blog into an “ActivityPub actor” of its own, separate from your current Mastodon account (but from which you could, e.g., “boost” your blog’s posts); this requires the ActivityPub plugin. This is a bit different from “simply” crossposting, though, and may be more taxing on your server. That said, any comments should make it back to your blog.
    • A third would be to use a different “variant” of the above-mentioned Bridgy tool called “Bridgy Fed,” which not just sends webmentions but also does something similar to the ActivityPub plugin (i.e., turn your blog into an actual “Fediverse actor”). I have limited experience (as in, none) with this one, unfortunately.
    Thread Starter elliekennard

    (@elliekennard)

    Thanks Jan, I’ll look into them.

    I am finding that the post text which I calculated including hashtags to be 497 characters was truncated to only a few words. How can I make it longer?

    https://mstdn.ca/@EllieK/111251065256360941

    Cheers

    Ellie

    Thread Starter elliekennard

    (@elliekennard)

    I have actually edited the post since then on Mastodon itself, but would prefer to have it go out as posted if possible, within the limits.

    Plugin Author Jan Boddez

    (@janboddez)

    So, the plugin takes WordPress’ default (either set manually or autogenerated) excerpt and then removes anything beyond 125 characters.

    To increase this limit, you could try adding a bit of code to either your (child) theme’s functions.php file or a “must-use plugin.”

    It’s probably easiest to simply drop a file called longer-excerpts.php (or something, it really doesn’t matter) in your WordPress install’s wp-content/mu-plugins folder (create it if it doesn’t yet exist), with the exact following contents:

    <?php
    
    add_filter( 'share_on_mastodon_excerpt_length', function() {
        return 400; // Or another "still safe" number.
    } );

    (If it somehow doesn’t work or you accidentally end up breaking the site, just remove it again!)

    You may have to play with that number a bit to make things work for your use case.

    Another possibility is to use a (much) more complex bit of code; like, I did actually create an add-on plugin that looks at the tags and so on to calculate a more optimal threshold, but it’s (currently) meant to work with specific post types only. A PHP developer would definitely be able to make it smarter, though.

    • This reply was modified 9 months ago by Jan Boddez.
    Thread Starter elliekennard

    (@elliekennard)

    Thanks a lot, I’ll give that a try, creating that file and dropping that into the folder.

    I appreciate the support.

    Ellie

    Thread Starter elliekennard

    (@elliekennard)

    First, I don’t have an mu-plugins folder. I have a plugins one. Do I put it in there, or create a different folder and at what level?

    I am no developer, at soon 74 I can follow instructions like this, but am not into tweaking or the like!

    Cheers

    Ellie

    Thread Starter elliekennard

    (@elliekennard)

    I’m an idiot. I didn’t read. I’ll create the directory.

    Thread Starter elliekennard

    (@elliekennard)

    Plugin Author Jan Boddez

    (@janboddez)

    Awesome! (I think you might have a comma somewhere in the “template,” still. Not sure if that was intentional.)

    Thread Starter elliekennard

    (@elliekennard)

    what ‘template’? If so, I haven’t done it intentionally.

    how would I separate the title?

    Thread Starter elliekennard

    (@elliekennard)

    Okay, found the template, not sure how it affected the results. But have removed it.

    The title runs into the text which I wish it wouldn’t.

    Plugin Author Jan Boddez

    (@janboddez)

    You could just move the various template tags onto a new line each. Or add quotes or something around the title.

    Just an example:

    “%title%”
    
    %excerpt%
    
    %tags%
    
    %permalink%

    So, the overall “template” is defined at Settings > Share on Mastodon > Advanced. It’s a setting called “Status Template.”

    And then there’s an option to still tweak it on a per-post basis. Which, when enabled, would give you a similar field on the New/Edit Post screen. (But you may not even need it.)

    Thread Starter elliekennard

    (@elliekennard)

    Perfect. Some things are obviously not as complicated as I think. Thank you again.

    The photo posts are working well, as the alt text applied to the image in WordPress are ported to the mastodon post image.

    Thanks again

    Ellie

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How do I include the Post Text?’ is closed to new replies.