2.8 KiB
2.8 KiB
+++ title = "HOW-TO: A super simple blog" +++
Someone recently asked me how they can setup a blog. They are a Linux user, so I am (ab)using that to craft a really simple writing process for blogging. The setup is a little bit technically inclined, but I am hoping this is easy enough to follow
Lets begin...
Tech stack
Codeberg pages for hosting our website
Xlog for generating a pre-styled and fairly simple blog, with a lot of automatic features
Directory structure
File | Usage |
---|---|
blog/xlog |
Generates the blog |
blog/build-and-upload.sh |
Uses xlog and then uploads blog to site |
blog/index.md |
Website Homepage (required!) |
blog/a_blog_post.md |
An example blog file |
blog/another_blog_post.md |
Another example blog file |
blog/public/ |
Generated html; uploaded to Codeberg pages |
Setting up
- Make a codeberg.org account - choose a username for desired "USERNAME.codeberg.page" website
- Make a new repository called
pages
using the plus button next to your profile picture - Make a folder on your pc for your blog
- In that folder... down and extract github.com/emad-elsaid/xlog/releases/latest
- Probably want
xlog-linux-amd64.tar.gz
- You only need the
xlog
binary from here
- Probably want
- Make a file called
build-and-upload.sh
with the following contents:-
#!/bin/bash cd "$(dirname "$0")" ./xlog -build public cd public git add . git commit -m "Update blog" git push -u origin main
- This script turns your blog posts into website code and then uploads it to codeberg
-
- Make
build-and-upload.sh
executable, normally under rightclick->properties - Getting an access token (so we can upload without signing in)
- Go to codeberg.org/user/settings/applications
- Type in a name for your token... e.g. "blog upload"
- Under "Select permissions", set "repository" to "Read and Write"
- Press "Generate Token"
- Copy the token
- Setup your pages folder...
- Right click inside your blog folder and "open in terminal"
- Run
git init
- Run
git checkout -b main
- Run
git remote add origin https://YOUR_TOKEN@codeberg.org/YOUR_USERNAME/pages.git
- We are setup!
- Bonus: Make an application menu entry for upload with something like PinApp. Set the executable to your
build-and-upload.sh
file
Writing process
Write markdown files (i.e. in beaver notes) and put them in your blog folder
Then run your build-and-upload.sh
script
All your change will be at USERNAME.codeberg.page
Note: Remember to write your homepage file
index.md
Conclusion
Happy blogging!!