From 7cacc574bcfbd4c3a586c2b89ae7dbab580009b0 Mon Sep 17 00:00:00 2001 From: CactiChameleon9 <51231053+CactiChameleon9@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:10:22 +0000 Subject: [PATCH] Blog: add HOWTO simple blog setup guide --- .../blog/2025-01-09-HOWTO-a-simple-blog.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 content/blog/2025-01-09-HOWTO-a-simple-blog.md diff --git a/content/blog/2025-01-09-HOWTO-a-simple-blog.md b/content/blog/2025-01-09-HOWTO-a-simple-blog.md new file mode 100644 index 0000000..3bf7249 --- /dev/null +++ b/content/blog/2025-01-09-HOWTO-a-simple-blog.md @@ -0,0 +1,77 @@ ++++ +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](https://codeberg.page) for hosting our website + +[Xlog](https://xlog.emadelsaid.com) 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 +1. Make a [codeberg.org](https://codeberg.org) account - choose a username for desired "USERNAME.codeberg.page" website +2. Make a new repository called `pages` using the plus button next to your profile picture +3. Make a folder on your pc for your blog +4. In that folder... down and extract [github.com/emad-elsaid/xlog/releases/latest](https://github.com/emad-elsaid/xlog/releases/latest) + 1. Probably want `xlog-linux-amd64.tar.gz` + 2. You only need the `xlog` binary from here +5. Make a file called `build-and-upload.sh` with the following contents: + - ```sh + #!/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 +6. Make `build-and-upload.sh` executable, normally under rightclick->properties +7. Getting an access token (so we can upload without signing in) + 1. Go to [codeberg.org/user/settings/applications](https://codeberg.org/user/settings/applications) + 2. Type in a name for your token... e.g. "blog upload" + 3. Under "Select permissions", set "repository" to "Read and Write" + 4. Press "Generate Token" + 5. Copy the token +8. Setup your pages folder... + 1. Right click inside your blog folder and "open in terminal" + 2. Run `git init` + 3. Run `git checkout -b main` + 4. Run `git remote add origin https://YOUR_TOKEN@codeberg.org/YOUR_USERNAME/pages.git` +9. We are setup! +10. 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](https://USERNAME.codeberg.page) + +
+ +> Note: Remember to write your homepage file `index.md` + +## Conclusion + +Happy blogging!! \ No newline at end of file