Developers
129 questions tagged ‘Developers’
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.
Recent Entries not working
So I have a markdown file where I want to show some recent entries at the end. According to the reference, this should work: {{#recent_entries}} <p><a href="{{url}}">{{title}}</a><br> {{#date}}<span itemprop="datePublished" content="{{dateStamp}}">{{date}}</span>{{/date}}</p> {{/recent_entries}} But it doesn't, unfortunately. I just get a blank space where the recent entries should be. :( Also, the reference says it shows the 30 most recent posts. That's too many for my needs. Is there a way to limit that to 5? Thanks!
Add class to currently selected page on my navigation?
Is there a way to add a class to the page you're currently visiting in the menu?
Next / previous posts following tag?
Would it be possible to use your next / previous templating on posts to only show the next or previous post for a specific tag?
Are CSS variables supported?
I'm setting up a new theme and I'm trying to add some CSS variables (example below) but every time I try, it seems that blot isn't parsing them and is basically ignoring that CSS. Are CSS variables supported? Example: :root { --text: #333; --bg: #fafafa; } body { color: var(--text); background: var(--bg); } Apologies if this question has been answered before, but the search bar isn't working for me. I just get a faded screen with no results.
Local template?
I'm gonna start building my own template for Blot. I've read through the developer docs and it mentions that one can have the template file locally in their Blot folder. The documentation doesn't say what that folder should be called in order for Blot to "see" it though? Does Blot even care? Or is it clever enough to recognise a template in the Blot folder and make it available for use in the dashboard? Thanks.
Backlinks don't seem to work in Magazine template?
I'm trying to replace latest links in entry.html to backlinks, i.e.: {{#backlinks}} <a href="{{{url}}}" class=" dim no-underline db pv2 bt b--black-10" style="position:relative"> <span class="w-10 fr db" style="background: no-repeat url({{thumbnail.medium.url}}) 0 0 / cover"> <span class=" db" style="height:0;padding-bottom:100%;overflow:hidden"> </span> </span> <span class="fl w-80 db black-80 flex" style="display: flex; flex-direction: column; justify-content: center;"><span >{{title}}</span></span> <span class="cf"></span> </a> {{/backlinks}} I replaced {{#recent_entries}} with {{#backlinks}} in above but nothing shows. I can confirm backlinks code works fine on blog template. Can you help sort this? This is on my "commons" blot account. I have templates disabled when I'm not hacking away on it to keep bots/folks from browsing it so you'll want to enable it and set use template to Copy of Magazine. (For some reason whenever I disable templates and turn it back on it always defaults to blog template so I have to switch it to magazine each time. Could be a bug?) For an example blog page with backlinks look for the "snippets" one.