independent-publisher icon indicating copy to clipboard operation
independent-publisher copied to clipboard

micoformats2: avatar leaks into post as "photo" property

Open sknebel opened this issue 6 years ago • 4 comments

It seems all instances of the avatar have class="u-photo" markup declaring them as a photo property. This is useful inside h-cards, but not all instances of the avatar are nested inside one. This causes the avatar to become a property of the post, which isn't right. I'm not really firm with Wordpress themes or PHP, but happy to help with the microformats side of things. My first hunch would be to not attach "u-photo" to the avatar automatically, and instead explicitly add it to the avatars in h-cards.

E.g. from the demo page: https://independentpublisher.me/2013/discovering-the-real-nepal/, the mf2 parser output contains the gravatar 3 times as a photo property:

{
    "items": [
        {
            "type": [
                "h-entry"
            ],
            "properties": {
                "name": [
                    "Discovering the Real Nepal (showcases Post Cover)"
                ],
                "photo": [
                    "https://secure.gravatar.com/avatar/a058cfca65a5103e838b1d0ea077ca4b?s=32&d=mm&r=g",
                    "https://secure.gravatar.com/avatar/a058cfca65a5103e838b1d0ea077ca4b?s=100&d=mm&r=g",
                    "https://secure.gravatar.com/avatar/a058cfca65a5103e838b1d0ea077ca4b?s=100&d=mm&r=g"
                ],

I investigated this today because it caused issues with @jgmac1106's syndication of a post to Twitter to attach his avatar to the tweet as a picture: https://twitter.com/jgmac1106/status/1022789703261724673

sknebel avatar Jul 27 '18 12:07 sknebel

I'm interested to know how to fix this in the interim, while we wait for the developer to look into this - I'm currently using Brid.gy to cross-post to Twitter and it's a bit annoying to have my avatar cross-posted as well.

vishae avatar Aug 07 '18 05:08 vishae

@vishae I would recommend forking the repo. There are others willing to help maintain the theme.

There are a number of issues to be addressed.

jgmac1106 avatar Aug 07 '18 09:08 jgmac1106

I haven’t tried forking the repo yet, but I guess I should note down my workaround for now, in case anyone is interested.

I found and commented out the independent_publisher_mf2_get_avatar_data function in inc/mf2.php, and it seems to work fine now.

Then you might want to look into this (https://stackoverflow.com/questions/20473004/how-to-add-automatic-class-in-image-for-wordpress-post) to automatically add a “u-photo” class to images in your post.

vishae avatar Aug 14 '18 02:08 vishae

I came to report a conflict with the same function and Gutenberg's Latest Comments block.

mkaz avatar Nov 26 '18 19:11 mkaz