-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support metaformats fallback option #224
Comments
Hi @aciccarello, thanks for the heads-up for this one. I've started an implimentation in #226. I've not made any real progress except to introduce the experimental option, and a single test that is failing (as it's not implemented) It will take me quite a while to get my head back into this and to figure out how to include it, but at least it's on my radar. Any help here would be appreciated, even if it's just more test cases 🙏 |
@aimee-gm I'm glad to hear you're open to this feature 🎉 . As far as I know there hasn't been many implementations of metaformats so there could be a few questions that come during implementation. I took a look at the microformats-parser codebase earlier (which was impressively straightforward 👏 ) and think I've got an idea of where to go with this. I'll see if I can put some more code together. |
I looked into this more today and there are a lot of potential edge cases. I've tried to add test cases on my fork for as many as I could To name a few:
When I looked at some actual pages with meta tags and how to implement the spec, I had a lot of new questions about adjustments the spec may need
I'll try to work out the spec questions in the indieweb chat to get clarification. I'll also continue looking at a possible implementation. My initial attempt ran into problems with needing to keep track of whether metaformats were enabled and how to combine potentially conflicting meta tags. |
The main thing to remember is that this is experimental - so for an initial pass, we can implement as much, or as little, as we'd like. The main hurdles as I see it:
As for which I would attack first, I would consider just handling the Beyond that, it should just be implementation and interpretaion of the spec. As for an approach, there is a step where the document goes through a "setup" phase - picking out elements with IDs, handling templates etc. Then the microformats are parsed. I was wondering if we were to add a step between these, which would see if metaformats would need parsing, and to modify the relevant elements to have necessary class properties to fool the parser into parsing them correctly. |
That's a good point, we have some flexibility here. I like the idea of applying classes during a pre-parsing pass. My latest proof-of-concept was able to use that approach fairly well. There are still some things to sort out. I think it would be good to indicate in the mf2 response an item was parsed using metaformats. While parsing, it could be challenging to figure out the fallback values when tags are in a different order. There could also be some intra-tag dependencies that could make things more difficult too. |
Had some conversations in the indieweb chat (starting on 2023-07-15). Sounds like there is consensus that metaformats should only be returned if there are no mf2 on the page. There are some concerns about badly formatted |
@aciccarello this is now merged and released as |
Great! Thanks for taking a look! |
Describe the feature
An experimental option should be available to use meta tags as a fallback for sites that don't natively implement microformats. The Metaformats spec defines changes to the microformats parsing algorithm to support this.
Adding an opt-in feature would allow using microformats as the vocabulary for understanding other sites while not interfering with pure microformats parsing.
Example of input
GitHub Issue: #39
Example of output
Here's the output of opengraph-mf2 which implements this general concept (though limited to OpenGraph).
Additional context
This was prompted by getindiekit/mf2tojf2#20
More details found on the Indieweb Wiki.
The text was updated successfully, but these errors were encountered: