Developers
132 questions tagged ‘Developers’
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.
How to make the blog title clickable?
For my blog I would like to make the title of the post on the page clickable – for example if you click the blog heading / title of the Welcome post it takes you to the post as well / like when you click the date at the bottom of each post. I forked the template 'Blog' but not sure where I am looking to achieve this for every post going forwards? Overall where in the 'Blog' Template do I look to make every post heading clickable on the main page of my site like the date does and what code do I need to input where in the template?
Buy Me a Coffee support?
I was wondering what is the easiest way to embed Buy Me a Coffee into a website on Blot?
Question about how Blot works?
In the developer docs it says Check if there is a template whose route matches the request’s path. Render the template if it matches. Check if there is a file which matches the request’s path in your blog’s folder. Send the file as a response if it matches. First I didn't really understand this (me being locked into another model of thinking) but if I've understood things correctly it means that when I link to a page, for example 'archive', it will use the archive template file to see what needs to be done. Questions: What are the "standard" templates that blot expects to see? archives, entries, entry, error, feed, search, tagged?? If a template use partials then it becomes possible to call that partial and it will be rendered. At least this is what I see when I call "head.html" and "header.html" (using the Blog template). Have I understood things correctly?
Trouble with a page on my template?
I'm having some trouble with my /now page. It's stuck showing the content from a now.html file that is no longer in my Blot folder. I want it to load from the now.md file in my Pages folder. Also, appending ?source=true to the URL to see the source content doesn't work. I've tried rebuilding my posts and pages from the Reset menu, but no dice.
Adding a badge to my template's footer?
I would like to add this "Written by human not AI" badge somewhere at the foot of all of my blog posts I can't figure out how to upload a png or svg into the blog source though.
Changing background color with metadata?
Hello! Using a custom template here, based on an old version of the Essay template. I'm wondering if there's a way to specify an individual post's background color using Blot metadata. I'm already using the variable bg color in my CSS, but it grabs what color is specified in the template setting. (I'm overriding this on the template's dark mode variant). body { background: {{background_color}}; } What I'd like to do is specify a color in each post's metadata, which then gets loaded in place of that CSS variable. Any help would be much appreciated!
Error checking if page is active in menu ?
When I put the following in my template, I get the error Unclosed section "active} <div class="menu"> {{#menu}} {{#active}} <a href="{{{url}}}" class="light active">{{label}}</a> {{/active}} {{^active}} <p>hello</p> {{/active}} <a href="{{{url}}}" class="light">{{label}}</a> {{/menu}} </div>