The source code for building www.alexgose.com and publishing on Github Pages.
This is the repository for www.alexgose.com, which is currently hosted on github pages. You can use the source code here as a template for generating your own website using Pelican, with the pelican-bootstrap3 theme, in a Docker container. Alternatively, you can follow the instructions for installing Pelican on your own machine.
To use the code in this repository for your own website, you will need to modify the Makefile and configuration (.py) files appropriately. These files were automatically generated by the pelican-quickstart
command, which is installed with Pelican. You will also have to create your own github repository. The instructions explain how the ghp-imports program publishes a website. This program is used inside of the docker container. Read this blog post for detailed instructions.
First, if you don’t already have Docker installed on your machine, then follow the installation instructions for your particular operating system.
We’ll begin by building the www.alexgose.com website locally. This is a good intermediate step before building your own website. We will convert all of the markdown files in the “content” directory into html files in a separate “output” directory. As long as Docker is installed, you should be able to build the html files, independent of which operating system you use. However, the instructions here are specifically for a Linux machine.
Download the files from this repository to the directory that you want to use for building the website. If you are using a Linux operating system, then this can be done at the command line using git as follows:
$ git clone https://github.io/alexgose/website
Next, build the “pelican” Docker image by entering the following at the command line:
$ docker build -t pelican .
Finally, we run pelican inside of a Docker container:
$ docker run --rm -it -p 8000:8000 \
-v $(pwd)/content:/website/content:ro \
-v $(pwd)/output:/website/output pelican make publish
This should produce the website files in the “output” directory.
Note: you may have to replace each appearance of $(pwd)
above with the path to the current working directory. The above command will work without modification if you are using bash with Linux.
If you successfully followed the instructions for a local build above, then you can build and serve the website locally using the following command:
$ docker run --rm -it -p 8000:8000 \
-v $(pwd)/content:/website/content:ro \
-v $(pwd)/output:/website/output pelican make devserver
You can see the website (locally) by opening a browser and visiting http://127.0.0.1:8000. The note above about replacing $(pwd)
with the path to the current working directory applies here as well. On Linux you can shut down the local server by pressing “Ctrl+C” in the command window.
Alexander H Gose
The contents of the content directory are released under the CC BY-SA 4.0 Creative Commons license. The Makefile, pelicanconfig.py, and publishconfig.py files are modified files from the Pelican project and are therefore covered under the AGPL license. All other files, including the Dockerfile and this README.md file, are released under the MIT license.
Thank you to all those who contributed to the projects mentioned in this “README.md” file.