More actions
(Created page with "= Building a site with Zola and Sourcehut = == Introduction == The following is a small tutorial on how to build a static webpage using [https://www.getzola.org/ Zola] and [https://builds.sr.ht/ Sourcehut's build service]. This guide is somewhat redundant since Zola's documentation is already very clear, but I want to write a first post in order to test this site. <br> == Prerequisites == First off, download Zola using your package manager. [https://www.getzola...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Technical guides]] | |||
== Introduction == | == Introduction == |
Latest revision as of 06:15, 28 August 2024
Introduction
The following is a small tutorial on how to build a static webpage using Zola and Sourcehut's build service.
This guide is somewhat redundant since Zola's documentation is already very clear, but I want to write a first post in order to test this site.
Prerequisites
First off, download Zola using your package manager. Installation instructions can be found on their site.
After that, create an account on Sourcehut. I paid for the "Amateur Hackers" tier as I'm just getting started with this project.
Creating a static webpage
All commands assume you are at the root of your project.
Zola
Once you've downloaded Zola, create an empty directory, initialize your site, and initialize a git repository:
$ mkdir www && cd www $ zola init posixlycorrect.com $ git init
Test everything is fine:
$ zola serve
If it is, download a theme:
$ mkdir -p themes $ cd themes $ git clone https://github.com/pawroman/zola-theme-terminimal.git
Add content to your site:
$ mkdir -p content $ cd content $ nvim _index.md ## add to this whatever your theme needs in order to work ## usually this is detailed on the theme's docs $ nvim blog.md ## landing page for posixlycorrect.com/blog $ mkdir blog && cd blog $ nvim building_a_site_with_zola_and_sourcehut.md ## your first post $ cd .. $ nvim about.md ## your about page
Check that everything looks good:
$ zola serve
Sourcehut
Your site is now ready to be published! In order to do that, commit your changes and add a remote repository from Sourcehut:
$ git add . $ git commit $ git remote add origin git@git.sr.ht:~fabianmv/posixlycorrect.com
Add a build manifest so Sourcehut knows how to publish your site:
$ nvim .build.yml
My manifest looks like this:
image: alpine/edge packages: - hut - zola oauth: pages.sr.ht/PAGES:RW environment: site: posixlycorrect.com sources: - https://git.sr.ht/~fabianmv/posixlycorrect.com tasks: - build: | cd posixlycorrect.com mkdir -p templates zola build - package: | cd posixlycorrect.com tar -C public -cvz . > ../site.tar.gz - upload: | hut pages publish -d $site site.tar.gz
Add and commit your changes and push your repository:
$ git add . $ git commit $ git push
Your website should now be visible! Updating it is a matter of making changes and pushing to your repository.
Good luck!
If you have any questions, feel free to email me.