How to set up blogging with Hugo on Gitea in Codeberg ๐
- First create a public repository named ‘pages’ in Codeberg
- If your username is
foo, then you get a page site in Codeberg asfoo.codeberg.page - In a folder use git to clone the repository with
git clone https://codeberg.org/foo/pages.git where foo is your username
-
You will now have a folder named ‘pages’ in the folder
-
Install Hugo from their website
-
Follow their instructions on getting started to set up a
site, instructions here
hugo new site blogsite
This will create a new folder named ‘blogsite’ and it will contain a file named ‘config.toml’
- Use the following settings in the
config.toml
baseURL = "https://foo.codeberg.page" (where foo = your username)
... (other values as default)
theme = "mini" // you can set up any theme you like
publishDir = "blog"
- Save the file and exit
- Create a new blog post with
hugo new posts/my-first-post.mdwheremy-first-post.mdis the name of your new blog post
In the post, write what you want to write, remember to set your meta-data correctly:
title: "My First Post"
date: 2019-03-26T08:47:11+01:00
draft: false // this part is important, leave it as 'false' otherwise your site will not show!
Write the post in markdown text format
-
Once you are done, test how the post will look like with
hugo serverand view it inlocalhost:1313 -
If you are happy with the site, then
cdinto the folder where your blog resides and generate the static site and blog withhugo -
The next steps are important:
- Copy the contents of the
blogfolder to thepagesfolder with the following code
cp -R blogsite/blog/ pages
- Now upload the pages to your site with git with
cd pages
git add .
git commit -m "added files to the site"
git push -u origin master
If everything goes well, your site will be live after the changes are reflected on your site.
For any future changes, yoou will need to do:
hugo new posts/name-your--post.md
//set the draft to false
Then repeat steps 10-13