espelhamento de
https://codeberg.org/cyrneko/pages.git
sincronizado 2025-11-10 10:38:24 +00:00
82 linhas
Sem EOL
4,4 KiB
Markdown
82 linhas
Sem EOL
4,4 KiB
Markdown
---
|
|
id: 3ylpn7xw2Eo
|
|
title: Getting makko to work with Codeberg pages
|
|
description: or Kitsupages, or pages.gay, or maybe even GitHub pages?
|
|
visibility: public
|
|
created: 2025-08-01T20:37:29+00:00
|
|
author: Alexia
|
|
---
|
|
|
|
So, it's been a bit since we released [Makko 2.0!](https://forge.starlightnet.work/Team/Makko)
|
|
|
|
If you don't know, Makko is our blogging tool and static site generator, it's stupid fast, stupid small and stupid simple, as long as you know even a tiny bit of HTML.
|
|
|
|
Though, in the context of deploying to Codeberg, or Kitsu.page, or pages.gay or a bunch of other free, git-based website hosts, there is one fatal flaw in our design: With makko, you're intended to serve your `output` directory only, by default that's `web/`; But all of these services will just use your whole ass blog folder including the `input` and `templates` directories
|
|
|
|
So if we want to use Codeberg Pages without the fear of losing our input files, we're gonna have to get a bit creative
|
|
|
|
## The basics
|
|
|
|
So first off, as I said, this isn't *quite* how makko was intended to be used, but for our purposes it will work just fine!
|
|
|
|
As I said, usually a makko blog will work something like this:
|
|
|
|
You have three directories, as defined in your `makko.json`:
|
|
|
|
- `input` → `blog/`
|
|
- `output` → `web/`
|
|
- `templates` → `templates/`
|
|
|
|
the `→` here represents the default directories, if you didn't change those, you're about to!
|
|
|
|
So, I'm writing this with the assumption that you *already have* a website
|
|
So your repo is already filled with an `index.html` and you already have a `styles.css` or something of that nature
|
|
|
|
In that case, we wanna make some adjustments to our `makko.json` before we run makko on our site *(run it once to generate the JSON config!)*:
|
|
|
|
- `input` → `blog_input`
|
|
- `output` → `blog`
|
|
- `templates` → `templates`
|
|
|
|
now with THIS layout, our final page goes into `blog/`
|
|
|
|
conveniently, this would mean the blog is available at `example.com/blog`, because the way that browsers, HTML and HTTP work in the context of Codeberg/Kitsupage/Pages.gay is that when you navigate to a subdir with no particular file, you'll be served `index.html` first
|
|
|
|
And our `blog/` just so happens to have an `index.html` generated by makko!
|
|
|
|
## Adding content...
|
|
|
|
of course you're gonna want to add some content. Makko ships with an example post that features some text, a table, some headers, blah blah you get the idea
|
|
|
|
You can run `makko` again on the folder for it to generate the example site and you can then, if you want, immediately push/upload that to codeberg/kitsupage/etc !!
|
|
|
|
You'll see when browsing to blog/ though that links and styles are gonna be all broken... and that's expected! Makko expects to run at / but right now it runs at `/blog/` so it's a bit confused
|
|
|
|
There is two ways for you to fix this, depending on your needs:
|
|
|
|
- **If you wanna make the "URL" of your page your homepage:**
|
|
Set the URL in makko.json to `example.com` instead of smth like `example.com/blog`, then anywhere in `templates` where you see `{{url}}` you replace it with `/blog/{{url}}`
|
|
- **If you wanna make the "URL" of your page your makko blog page:**
|
|
Just change the `url` in `makko.json` to `example.com/blog` and...I think that's it?
|
|
|
|
Either way, you absolutely MUST make sure that in your template files (feed.html and post.html) your `styles.css` is set to `/blog/styles.css`. UNLESS you want to re-use the same CSS that your "real" main page used before
|
|
|
|
Otherwise it'll use default browser styles for light theme!
|
|
|
|
This means you wanna make sure the `<head>` section has something like this:
|
|
|
|
```
|
|
<link rel="stylesheet" href="/blog/styles.css">
|
|
```
|
|
|
|
## Profit?
|
|
|
|
*in theory* that is all you should have to do for the default Makko templates and styles to work
|
|
|
|
of course for setups where you wanna i.e share the same styles.css between the blog and your main index.html you'll probably wanna adjust your `feed.html` and `post.html` so that the structure roughly matches, but that's for yourself to figure out (well, mostly at least)
|
|
|
|
If ya need help, you can always check [where to find us](https://starlightnet.work/where.html) so that you can talk to us for help :)
|
|
|
|
or if ur a bit too shy to talk to the masses, just talk to me directly instead, or post on fedi and ping @the@starlightnet.work; Whatever floats your boat :)
|
|
|
|
You can also take a look at [this website's source code](https://codeberg.org/cyrneko/pages) to see how I set it up :3 |