-
Notifications
You must be signed in to change notification settings - Fork 96
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
h-entry support #300
Comments
It looks like an interesting format. I'll take a look at it and give it some consideration. From what I can tell it just uses classnames on elements to create a machine-readable format (similar to RSS or Atom but integrated into the content rather than in a separate feed). I'm generally conservative about adding new formats and features since my goal with Bear is longevity and stability over feature-full-ness. What are the use-cases for h-entry for you? |
It would allow us to participate in more IndieWeb directories since they use these kinds of properties to tell what is an article and what is an H Card and more. |
On my blog, I parse h-entry metadata to easily quote and reblog posts from other blogs, but there are all sorts of uses. For example, if someone is using WebMentions (for example by hooking up their RSS feed to https://webmention.io/), h-entry metadata makes it possible for mentioned sites to include extra metadata about the mention like the author's name or a snippet of the post. |
Cool, that makes sense. I'll play around with it a bit today, there are just a few structural elements that don't conform to how Bear is currently set up (specifically having e-content and p-summary as a child element of h-entry). I can't change the underlying structure of the web-page without breaking the styling of hundreds of blogs, so full h-entry support may need some extra templating to work. I'll let you know when I have something for you to experiment with :) |
Some blogs handle having |
I've been playing around with supporting h-entry microformat on Bear, and while not impossible, it would require fairly extensive modifications to the existing page structure, or by adding additional complexity to drill information into parent templates. That being said, Bear is set up in such a way that it keeps a very simple and sturdy base while allowing extensibility. Here's how you can make your blog h-entry compliant using Post template: Set the post attribute: class_name: h-entry Then structure your post content as follows: <h2 class="p-summary">{{ post_description }}</h2>
<div class="e-content">
Here are some good words. Good words indeed :)
</div>
<!-- hidden h-entry stuff -->
<div style="display: none">
<p class="p-name">{{ post_title }}</p>
<a class="u-url" href="{{ post_link }}"><time class="dt-published" datetime="{{ post_published_date }}">{{ post_published_date }}</time></a>
</div>
<!-- author card stuff -->
<p>
Published by <a class="p-author h-card" href="{{ blog_link }}">Herman</a>
<br>
<img class="u-photo" width="150"src="https://bear-images.sfo2.cdn.digitaloceanspaces.com/test/ginger-cat-camera-access.png" />
</p> This structure can be saved as your Post template so that all of your posts default to having h-entry support. You can also add the author card to your footer if you're on an upgraded blog, otherwise keeping it in the post template will work fine. This also allows some extra extensibility such as being able to hide One alternative is also to wrap the entire post content template in Here's a link to this running on my test blog. If you have any questions, comments, or suggestions, please leave them here or email me personally :) |
Do you mind if I take a shot at adding this to the base templates? I think it would be really valuable to have this available by default, without users needing to muck around with their post templates. |
I appreciate the enthusiasm for the project :) The problem here isn't the difficulty with doing it. The main issue is that by modifying the structure of the page it will break styling selectors (and JS selectors, if people have added some) across many blogs. This is because the There are close to 50k blogs on Bear right now and it would be irresponsible for me to change the page structure willy-nilly. So the challenge is adding support while not changing the structure 😄 One thing I'm unclear on with the structure of h-entry (and can't seem to find an answer anywhere), is whether the following is semantically correct: <body class="h-entry">
<main class="e-content">
<h1 class="p-name">Post title</h1>
<h2 class="p-summary">Post description</h2>
<p>Some post content</p>
<p>More post content</p>
</main>
</body> If the above is semantically correct, then we could reasonably just inject classnames instead of changing the page structure. However it feels like it may lead to some data extraction ambiguity since Alternatively, the best way to potentially go about supporting h-entry would be to create another template that is h-entry specific (essentially a copy and paste of the existing post template but with the necessary modifications). Then applying an h-entry support toggle in the blog model to specify which template to use. (Also, I apologise for being so difficult about this, but I'm trying to prioritise stability and maintainability with Bear.) |
Another tangental question to the last one. Let's say we have a new template where |
Ah, that makes sense. Backwards compatibility is important.
This is valid, although as you might expect it does result in the title and summary being duplicated in the content, which may result in consumers repeating the title and description. You can test it here, which parses it to {
"type": [
"h-entry"
],
"properties": {
"name": [
"Post title"
],
"summary": [
"Post description"
],
"content": [
{
"html": "<h1 class=\"p-name\">Post title</h1>\n <h2 class=\"p-summary\">Post description</h2>\n <p>Some post content</p>\n <p>More post content</p>",
"value": "Post title Post description\nSome post content\nMore post content"
}
]
}
} Another possibility would be to include the content in a separate, invisible div:
...but then you're sending down a lot of extra bytes that are useless to most people.
Yes, this html: <body class="h-entry">
<h1 class="p-name">Post title</h1>
<time class="dt-published" time="2024-10-10T23:51:17Z">10 October 2024</time>
<main class="e-content">
<h2 class="p-summary">Post description</h2>
<p>Some post content</p>
<p>More post content</p>
</main>
</body> parses to this: {
"type": [
"h-entry"
],
"properties": {
"name": [
"Post title"
],
"summary": [
"Post description"
],
"published": [
"10 October 2024"
],
"content": [
{
"html": "<h2 class=\"p-summary\">Post description</h2>\n <p>Some post content</p>\n <p>More post content</p>",
"value": "Post description\nSome post content\nMore post content"
}
]
}
} I'm not sure i understand why a summary would be mandatory on posts, though, since |
It would be very cool to support the h-entry microformat out of the box, which annotates posts with a few simple classes to make them easier to quote, reference, reblog, and so on. If this is something that you'd be interested in, I'd be happy to take a crack at it.
The text was updated successfully, but these errors were encountered: