Custom Front Matter

Nice, that’s a smart hack! :blush:

1 Like

I think I understand this, but can you point to a post of yours where you have used the bespoke excerpt and show how it displays vs how it appears in your editor?

Sure!

Here’s the post in the editor:

Here’s how it appears on a list page (only the excerpt appears):

Here’s how it appears on an article (single) page (only the body, not the excerpt appears):

If you just write a long post, without using the <!--more--> tag, the auto-generated excerpt will show in lists, and the whole post will appear on the article page. (Just like normal.)

One more note about the template code above: this code goes in your “article.html” partial. In your “list.html” partial, you’d just use {{ .Summary }}.

In my own personal style, I like the excerpt/summary to actually be a summary or précis, not just the first paragraph of the post. So this accomplishes that - I can write a summary that appears in lists, but that doesn’t appear on the post page.

PS. This post is here: It's a Test! // graphic content , but I don’t know how long I’ll leave it live on the site, because, ya know, it’s a test.

1 Like

Wow! This is great and how I was envisioning it. Thanks for the screenshots. I agree about the summary.

BTW, will the summary also appear that way in the Micro.blog timeline?

No, it just shows the title and link in the timeline.

I was actually just looking for a place to make a feature request on this: I would love a setting so I can choose whether to show title+summary+link or title+link in the timeline.

Dang it! I thought we finally had a hack for the timeline display for macro posts :smile:

BTW here’s a long thread just for feature requests. But no idea if @manton keeps an eye on it.

Yep, I read everything! I don’t usually comment just because discussions are difficult in a long thread like that.

2 Likes

No worries. As long as you read and are aware of the requests :smile:

This is achievable if you’re comfortable modifying templates, which you’ve already proven you are. :blush: What shows up on the Micro.blog timeline is controlled by the feed or feeds you’ve added to the Edit Sources & Cross-posting page. And you are in full control of the presentation of the RSS (and JSON) feeds by overriding their templates in your custom theme.

And for people who don’t want to tinker with custom themes (@pratik, maybe?), an alternative is to be more selective about what gets sent to the Micro.blog timeline. I, for example, only include short posts in my Micro.blog timeline. No long articles with headlines.

So, when I post a long article to my blog, I also write an accompanying short note where I summarize and link to the long article. Only the short note go to the Micro.blog timeline.

Instead of having the main feed (/feed.xml) included on my Micro.blog timeline, I’ve pointed it to the feed for the notes’ category (/categories/notes/feed.xml).

2 Likes

:star_struck: Cooooooool - thanks for that. I didn’t realize I could change that on my own!

Well, I do have a custom theme but have never dabbled with modifying the main feed template. However, I hate to be selectively about what I post. I do post both long and short posts here on Micro.blog. I tried the posting-the-long-ones elsewhere and adding its RSS link but too much friction in deciding.

I still post my long articles to my Micro.blog hosted blog. I just don’t automatically include them in the Micro.blog timeline. I write custom short notes instead. For example, this long blog post was promoted on the timeline by this short post.

Alright, alright, I got all excited but now I’m stuck. How/where do I tell Micro.blog to display the summary?

I changed the index.json template so that the “content_html” is the summary, not the full content.

But that doesn’t show in the timeline, it still just shows the title and link.

My “Edit Sources” is pulling from feed.json

Can you point me at what template or part of this template I need to change in order to have the summary and the link show up in the timeline?

You might have stumbled upon a race condition. When making a change to a template, it sometimes takes a while before Micro.blog rebuilds your site.

It could be that when Micro.blog added your test post to the timeline, the JSON feed was still the old version (with the full post). Try removing the latest post from the timeline (just from the timeline, not the actual post), and then try refetching the feed by navigating to the feeds page (linked above) and hitting the :arrows_counterclockwise: button.

Also, it’s worth noting that the changes you make to the feed only affect future posts. Posts that are already on the timeline will remain the same (unless you explicitly remove them to be re-added, but then you probably lose their comments).

Oh, sorry! You should remove the title from the feed as well. :blush: That’s what’s triggering Micro.blog to just link to the post. More about timeline display rules.

Hmmm. Removing the title does show the summary, but no link back to the post.

Ah. So I’ve removed the title, and made “content_html” be the summary - however, this summary is not 300 characters, so it’s just being displayed as-is without a link. But if I make a summary that is longer than 300 characters, it’ll just be truncated, too.

This just isn’t very feasible, I don’t think. Not for my use case, anyway.

So I’ll just go back to my feature request: the ability to specify how long posts are displayed, whether with the title+link or the title+summary+link (or even just summary+link, while we’re at it).

Oooh, weirdly, the timeline posts did change retroactively! I just deleted my custom index.json template, and now they appear like this

You could add a link to the post in your feed template. But you’re right about the 300-character limit. If the summary + link text are longer than 300 characters, Micro.blog will truncate. Unless you make it a quote, then you get 600 characters, but that’s kind of a hack. :blush:

And even if you get your feature request realized, I would be very surprised if @manton would allow arbitrary long summaries. They would probably still be truncated if they were longer than 300 characters.

I don’t need them to be longer than 300 characters, so that’s fine by me!