Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Profile h-card #5

Open
Ruxton opened this issue Jan 14, 2020 · 1 comment
Open

Profile h-card #5

Ruxton opened this issue Jan 14, 2020 · 1 comment

Comments

@Ruxton
Copy link

Ruxton commented Jan 14, 2020

The h-card info in the profile page seems to come from my h-entries and not the higher level (in the document tree) h-card on my site.

https://ruby.microformats.io/microformats?utf8=%E2%9C%93&url=https%3A%2F%2Fignite.digitalignition.net%2F shows the properties on the feed with much more info/larger avatar than the one embedded in each entry.

Shouldn't it prefer the higher level node?

@martymcguire
Copy link
Owner

Hey @Ruxton ! Thanks for looking at the webring!

You can find the code that handles finding representative h-card here:

https://github.com/martymcguire/indiewebring.ws/blob/master/lib/representative-h-card.js

The TL;DR is:

  • it uses the (somewhat outdated) microformat-node library to parse the page and return any h-cards found.
  • it checks for a card with both url and uid that point to the url they entered for their homepage. if it finds one, it uses it.
  • it checks for a card with a url that is also marked as rel="me" somewhere on the page
    • looks like i have a bug in this code! not sure if it's impacting your case, but it will result in taking the first card returned by microformat-node if there is any link on the page with rel="me" pointing to the homepage url.
  • finally, if there is only one card, and it has url matching the homepage url, it takes that.

I'm a bit constrained by the results of microformat-node, but I'm open to suggestions and PRs on improving this algorithm!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants