diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..548ac12 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine +RUN apk add hugo git +WORKDIR /hugo +RUN hugo new site /hugo +RUN git clone https://github.com/yihui/hugo-xmin.git themes/hugo-xmin +ADD hugo.toml /hugo/hugo.toml +ADD content /hugo/content +CMD ["hugo", "serve", "--bind", "0.0.0.0"] diff --git a/README.md b/README.md index 0e83280..54481a7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# blog stuff -Just some blog idk. +# gtz blog +An opinionated blog. +I write posts about technology and other interests that I have. diff --git a/content/about.md b/content/about.md new file mode 100644 index 0000000..9b26088 --- /dev/null +++ b/content/about.md @@ -0,0 +1,7 @@ +--- +title: About gtz blog +author: Asger Gitz-Johansen +--- + +This is just a simple blog. + diff --git a/content/posts/how-to-blog.md b/content/posts/how-to-blog.md new file mode 100644 index 0000000..6430df2 --- /dev/null +++ b/content/posts/how-to-blog.md @@ -0,0 +1,60 @@ ++++ +date = '2024-11-27' +draft = false +title = 'How to Host a Simple Blog' +tags = ['howto', 'tutorial', 'web'] +categories = ['technical'] ++++ + +No. I don't want to have a git repository with a million billion files that are auto generated by [hugo](https://gohugo.io/), [jekyll](https://jekyllrb.com/). +No. I don't want to use some non-official, homebrew, backwater, docker image made by some random guy that stopped maintaining the image in 2011. +I want my own dockerfile that is based on `alpine` or even use an image official to the framework. +No. I **definitely** don't want to use a WYSIWYG (What You See Is What You Get) editor - I have my own local markdown editor that works just fine thank you. +All I want i one (1) - i repeat - ONE fucking goddamn configuration file for the entire site (toml, conf, yaml I don't care) and blog posts should be written in markdown. + +If you are like me, read on. + +Additionally, there should be community made themes available - but I shouldn't have to fucking add them as a git submodule, god damn. +The blog should be hostable through a docker image that just takes your markdown and config file, builds the static website, and serves it using some standard server +(e.g. nginx or python's `http.server` I don't care which, as long as it is somewhat standard - If I am managing a docker container, I will manage the networking in docker) + +Ideally, the directory structure should look like this: + +``` +blog +├── Dockerfile // dockerfile to build and host the site +├── README.md // info about the repository, not a blogpost +├── config.toml // blog-framework configuration file +└── content + ├── about.md // the "about" page + └── posts // actual blog posts go here + └── example.md +``` + +And then to build the site, simply build the container: + +```sh +docker build . +``` + +Then you should just be able to insert the docker image into some docker-compose or kubernetes stack - or even just `docker run -d` if you'd like. +The point of this is that you should really just focus on writing the blog entries - not the blog website. + +If you want to use this workflow - this blog is written using this approach, so see my [gitea](https://git.gtz.dk/agj/blog) instance or the [github](https://github.com/sillydan1/blog) mirror for reference. + +The `Dockerfile` I have settled on goes like this: + +```dockerfile +FROM alpine +RUN apk add hugo git +WORKDIR /hugo +RUN hugo new site /hugo +RUN git clone https://github.com/yihui/hugo-xmin.git themes/hugo-xmin +ADD hugo.toml /hugo/hugo.toml +ADD content /hugo/content +CMD ["hugo", "serve", "--bind", "0.0.0.0"] +``` + +For now, I am just using the built-in server in `hugo`, but it should be possible to serve using `nginx`. + +I mentioned `hugo` before, but I was mostly mad that I had to add the autogenerated stuff in git - with this approach... I don't have to 🎊! diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..79cd179 --- /dev/null +++ b/hugo.toml @@ -0,0 +1,28 @@ +baseURL = 'https://blog.gtz.dk/' +languageCode = 'en-us' +title = 'gtz blog' +theme = 'hugo-xmin' + +[[menu.main]] +name = "Home" +url = "" +weight = 1 + +[[menu.main]] +name = "About" +url = "about/" +weight = 2 + +[[menu.main]] +name = "Categories" +url = "categories/" +weight = 3 + +[[menu.main]] +name = "Tags" +url = "tags/" +weight = 4 + +[[menu.main]] +name = "Subscribe" +url = "index.xml" diff --git a/posts/example.md b/posts/example.md deleted file mode 100644 index 00aa7a3..0000000 --- a/posts/example.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Example ---- -# Example Post -Some example text.