indieweb / php-comments

Helper for parsing and presenting comments from external sites
http://indiewebcamp.com/comments-presentation
Apache License 2.0
19 stars 5 forks source link

Discover Authorship #16

Open sebsel opened 7 years ago

sebsel commented 7 years ago

Since this repo is still used by a lot of sites, better to actually file issues :)

It seems like php-comments does not follow the algorithm for discovering authorship as described on https://indieweb.org/authorship Some chat around it: https://chat.indieweb.org/dev/2017-01-02#t1483370937764000

Few challenges with this:

  1. parse() takes a h- object. You pass in the $mf2['items'] part that comes out of a Mf2 parser, not the whole thing. This means you have no access to the $mf2['rels'] part of the page, where rel="author"-links reside.

  2. When the author is only a URL, (step 7) we need to grab another page. Currently, there is no curling nor mf2 parsing done inside of php-comments, so that's impossible.

@aaronpk's XRay does a better job at these things.

sebsel commented 7 years ago

Here's how I solved the problem outside of php-comments: https://github.com/sebsel/seblog-kirby-webmentions/blob/master/lib/endpoint.php#L85 This solves step 6.

I then wrote a messy hcard() function to grab a h-card for that url, and store it in a separate cache. https://github.com/sebsel/seblog-kirby-webmentions/blob/master/lib/author.php#L59

But that solution is not ideal and depends on your website setup.

aaronpk commented 7 years ago

Yeah, the trick is that people who are using this library don't want to be tied to whatever HTTP library happens to be used by this library, and I can't guarantee curl functions are available either. This would have to be solved by providing a hook where the library requests an HTTP request be made, and whoever is using the library would go make the HTTP request and return the result.