Closed sebsel closed 6 years ago
XRay's type
property is meant to represent the Microformats2 vocabulary of the object, rather than the post-type-discovery type of the post. So far I haven't needed a type=like
property from XRay, do you have a use case for that? I could see adding a new property that indicates that.
Well it's just that php-comments does more than XRay does currently. But that's no good reason.
Thinking about it: yes, I actually use this. https://indieweb.org/facepile#Sebastiaan_Andeweg
My webmentions are sorted by the type-field from php-comments. (That's how the plugin originally worked.) I use it to display in the facepile, with proper icon, or as a comment below it.
Of course I can write my own logic for it, which I did today to sort my own posts in my indexing database. I had enough of writing checks like that all the time, and creating separate bool fields in my database table. (An entry with a name is an article, but a bookmark with a name is no article.) The database-example is NOT a use case for XRay though.
Below is my current $page->postType() method (in Kirby), including commented-out things that I don't use, but found on the wiki.
public function postType() {
if($this->has('like_of')) return 'like';
if($this->has('bookmark_of')) return 'bookmark';
//if($this->has('tag_of')) return 'tag';
if($this->has('repost_of')) return 'repost';
if($this->has('read_of')) return 'read'; // << haven't implemented myself, now
if($this->has('watch_of')) return 'watch'; // << posting as text notes, but I have them!
if($this->has('checkin')) return 'checkin';
//if($this->has('invitee')) return 'invitation';
if($this->has('rsvp')) return 'rsvp';
if($this->has('in_reply_to')) return 'reply';
if($this->type() == 'event') return 'event';
if($this->type() == 'review') return 'review';
if($this->has('wrote')) return 'wrote'; // << is one is for myself only :/
if($this->has('video')) return 'video';
if($this->has('photo')) return 'photo';
if($this->has('name')) return 'article';
if($this->has('text')) return 'note'; // << 'text' = 'content'
return 'entry';
}
Oh, and I totally agree on keeping 'type' for Mf2 :)
New use case! :o
At this moment I display likes as <3 Seb vindt [dit] leuk.
(Seb likes [this]). I am changing this today by having XRay looking up the liked/bookmarked url. I am going to use the name
field to replace [dit]
, but sometimes there is no name for a post.
So I'm now writing checks for wether it's a photo, so I can say 'Seb likes a photo by Aaron Parecki', if the original post was a photo. It would be useful if XRay could do that for me. :)
(still writing my own checks now though... it's also not that hard, so maybe it's okay to do it myself)
I do think implementing the Post Type Discovery algorithm would be useful. I'll update the issue title accordingly.
I don't know if this is the right place, but since I was trying to capture some of php-comments shortcomings, here is a shortcoming of XRay I found :)
https://www.w3.org/TR/post-type-discovery/