Hi Adam, thanks so much for the new features and your video about it. It helps so much. Of course new features lead to even more feature requests Have you considered implementing some sort of truncate feature, so that with a given post length it gets truncated and only a āteaserā is shown on the landing pages?
I will add that over the weekend, no problem!
Iām just chiming in to mention that I added something like this with custom metadata using a āsummaryā and outputting it in the config for post-list. I donāt know what your naming convention will be and am curious if there could be: a) an automated one with a name like āteaserā, and/or b) a custom one like āsummaryā, or some way to differentiate (with fallback if the custom one isnāt provided). Also want to make sure my current implementation doesnāt collide with any new naming convention. You can check out what I did here on my archive (this uses post-list with the added summary var): Apple Annieās Weblog Ā· Archive
Edit: adding that maybe a marker like ā===ā in the post could be where a teaser ends and gets stripped in the Markdown and everything after is the body. Just an idea.
Love your setup! I donāt think there will be any risk of conflict because Iāll set this up as a configuration itemāsomething similar to the existing Titleless title length
item (introduced here), which can accept a value of n words
or n characters
. Then thereās Truncation appendix
which is what will appear at the end of a truncated chunk of text (if it was in fact truncated).
But I really like the idea of managing this within each postāthe marker idea is interesting! Might also try something like an HTML comment for that, e.g. <!-- summary -->
. Not sure; open to input!
Iām wondering too about interplay with existing solutions. Iāve something similar with a custom Excerpt
front matter that I call with $excerpt
in post listings.
Thinking out loud with no idea of what would be involved Iām wondering how complicated it would be to suss out a way for people with custom solves for this to use a built-in as a fallback.
Maybe not for soon but for later, a way to say in our format snippets some equivalent of the logic (in my case) a configuration settings like
Teaser override: excerpt
(or whatever someoneās used as a custom front matter)
and then in my templates Iād change anywhere I have {excerpt}
to {teaser}
which because of the above would output the new teaser if I hadnāt added any Excerpt:
front matter, but still output any manual excerpt for posts where Iād added that custom front matter.
Truncation has been added ā keeping it pretty simple for now. There is now a Landing page post length
configuration item, which can be set to values like 80 characters
or 45 words
. It will apply to landing page posts only when Landing page post count
is set to a value greater than 1. Itāll also append the Truncation appendix
value to any truncated post bodies.
BTW not sure what other people might think about it but maybe it would be a nice touch if the # title of an truncated post on the multiple post landing page would convert into a link to the full post as the date stamp does right now? And there is a small glitch with truncation that kicks in in the middle of a md link. Not sure if the truncation should kick in before or after or as it is right not just as defined ā¦
The title link is a neat idea ā let me see what I can do about that. As for the glitch you caught, thatās a super tricky problem⦠the kind that leaves me with a knot in my stomach. Itās easy for me to truncate a string after a certain number of words or characters, but itās not easy to do it in a way that avoids things like HTML, Markdown, or other scenarios where you donāt want the text to be truncated in that particular spot.
So, Iāll need to think about what I can do to mitigate that. This may be a simple case where automated truncation is just not the right solution to the problem. Might be that creating teasers or predefined excerpts is the way to go for maximum control.
However, one idea that just came to mind would be to convert the source Markdown text to HTML first, then strip all HTML tags, and then truncate that stripped string. That should eliminate the conflict with both Markdown and HTML, but it comes at the cost of losing all formatting on your truncated post bodies. Do you think thatās an acceptable tradeoff? (Personally, Iām not sureā¦)
Personally, I think losing all formatting on every truncated post would be much worse than displaying a broken md or html formatting occasionally. As I am no programmer at all, I can not estimate how hard it would be just to check the last āsentenceā after truncation was performed for not closed md and html tags and just strip them? In the long run I think it would be fine, to have this dump cut off after xxx words and in addition, as discussed above, some sort of placeholder / tag that allows to set the position manually. That way everyone could easily fix this by inserting the tag where it is needed or wanted.