Hey. Wondering if it’s even possible to do this: I want to host a static page for an event on my Micro.blog. But I’d like the page to be standalone. No navigation, no footer, no site name. Just the information regarding the event.
I can have the same CSS, that’s ok.
Read a few posts here, and went to town.
Created a content/event.md file, and got the normal page.
The front matter has “event” as type, so I copied the baseof.html and the single.html layouts to layouts/event/ and started trying to figure out what I’d have to delete, and what to keep to have it working.
But then I started wondering if I’d have to do the same to head.html and header.html, and if what I’m looking for is even possible. Maybe it’s even simpler and I don’t have to do all this.
At the moment I have a working solution at GitHub Pages, but on a different domain, and would really love to host it here.
Is this possible? Or should I just forget it?
Thankful for any help.
The only thing that will definitely be there is what’s in your
baseof template. So if your
footer are partials that are included in
baseof, you will have to remove them and move them somewhere else in order to achieve this.
Thank you so much. I’ll give it another shot, it’s all broken right now
Updated: I did manage to do it!
I have a single page, clean. No header, no footer, just the info regarding the event. Not finished yet, but it’s working.
Hardest part so far is getting the CSS right, I believe a lot is coming from the blog, and needs something to overwrite all that. But it’s working.
One way to host static HTML pages (or any file) is to put them in the
static directory. For example, say you have a file on your computer called
event.html, and you want to host it on your Micro.blog. Create a new template named
static/event.html and paste the content there. The page will be reachable at https://your.micro.blog/event.html.
If you want a prettier and shorter URL without the
.html file ending, you can name the template
static/event/index.html instead. Then, the URL will end up https://your.micro.blog/event/.
Is this explicitly described anywhere in the docs? It comes up often enough that it might be a useful addition to the help documents.
Yes, it’s mentioned in the docs. It’s unlikely that regular Micro.blog customers stumble upon it, though, as static file hosting is a feature targeted at theme builders and plug-in developers.
You can add them as static files under the “static” folder in the plug-in.
For example, if you want to include a CSS file named “hello.css” in your plug-in, it would be stored at “static/hello.css” and referenced in
includes with the path “/hello.css”.
This is a really good point that I totally forgot.