Log in Sign up

Developers

135 questions tagged ‘Developers’

Disable pagination?

I noticed that even when I don't use pagination in my template, typing /page/1 .. /2 .. etc. produces the pages with some result (depending on what's in the template). It's not a big deal, but I wonder if there is a way to disable pagination all along? I tried to create a redirect rule "/page/(.*)" > "/" but it didn't work out either

Recent entries filtered by tag?

I seems odd to me that I can easily filter "all_entries" array with "tagged.TagName" but I can not do the same with "recent_entries." If I use the combination inside a template it will output all "TagName" tagged entries within the last 30 entries. I guess the other option is "truncate" the output, but I couldn't find how to do that in the template language reference. I understand that there is a script option, but I'm already hacking too many things on blot with scripts and it's getting dangerous (( {{#all_entries}}{{#tagged.TagName}} <<-- how to limit output ? to X entries --| <a href="{{url}}">{{title}}</a> {{#tagged.TagName}}{{/all_entries}}

Lazy loading on images?

Wondering if anyone has figured out a way to introduce lazy loading for images? I know we can add loading="lazy" in the HTML, but I'd like a way to do it in Markdown, so I don't have to write out all the HTML for every image. When my site was based on Jekyll, I could use Kramdown and add {: loading="lazy"} after the image to add the required flag. But nothing like that exists AFAIK with Blot. Do any of you have any ideas please? I'd like to avoid introducing JS if at all possible. Thanks!

Hide or show certain sections depending on metadata?

I'm wondering if there's a simple way to hide a section from a page template if a certain metadata is specified. A bit like with Menu: No which hides a page from the navbar. I'd like to create a Hero Image: No which would disable the top image on a blog post. Your help is much appreciated :)

Choose different fonts for blog posts and site title/site menus

I'm new to Blot and have a question regarding font customization. I'd like to use different fonts for my blog posts (incl. blog title and body) and the title & menus of the blog. I forked an existing template but the font picker applied the new font to all the text in the blog. I dug around the source code but couldn't figure out how to achieve it.

Add page description to RSS feed?

So in my site's head I've added {{> description}} which will take the summary field from my front matter and add it to the page's HTML meta. I'm trying to create a second RSS feed that, instead of containing the entire post contents, I'd like to have the page description from the meta and a link to the post. This is so I can use Micro.blog to automatically crosspost a summary, rather than the entire (poorly formatted) post. So I've tried adding the following to my RSS file, but it isn't working: <description> <![CDATA[ {{#encodeXML}} {{{description}}} {{/encodeXML}} ]]> </description> I've also tried {{> description}} and {{{summary}}} but none are working. How do I add the page description to this RSS feed? Thanks.

Dynamic image for a Twitter Card for each post / permalink

I'm trying to work out a way to generate a unique twitter card for each of my posts, so when an article / permalink is shared on socials it gives a summary based on the first couple lines of the post and uses the first image in the post as the preview image. Currently I have a share card coming up with the text part of the preview but can't work out how to incorporate the image into it. Any help would be greatly appreciated.

Only show tags with a minimum number of posts?

Is there a way to show a list of tags only if there's a minimum number of posts (say three) tagged as such? I'm looking to do this to show a list of tags without cluttering it up too much and only showing those with a minimum number of tagged posts. Thanks. Ray

Show last modified/updated date on posts?

On another blot site I am working on it'll be a hybrid digital garden/blog. Since some pages and posts will be updated over time, is there a way to show the last modified/updated date instead of creation date? I could change the date metadata but it would move the post around due to how Blot displays posts in reverse chronological order. I'd rather leave it wherever it is and just show updated dates whenever folks browse it.

How to render raw moustache?

Let's say I want to embed some moustache code into a blog post, how do I do that? If I enter: <h1>{{ title }}</h1> The output on the frontend us just: <h1></h1> This is because Blot is trying to render the tag. I've tried changing the brackets to the unicode equivalent, but that didn't work. When I used Jekyll, I could wrap the code blocks in {{ raw }} to tell Jekyll not to try and render those elements. Does mustache have anything similar? I can't find anything in their docs.

Previous 1 5 6 7 8 9 14 Next