Prerequisites
We need to have at least Docker installed.
Creating the Blog
First we’re creating a new directory for our blog and generate the blog structure using William Jackon’s docker-pelican:
mkdir my-site
cd my-site
docker container run -it --rm --entrypoint pelican-quickstart -v ${PWD}:/pelican-site ghcr.io/williamjacksn/pelican
Welcome to pelican-quickstart v4.9.1.
This script will help you create a new Pelican-based website.
Please answer the following questions so this script can generate the files
1 Title: My First Review
needed by Pelican.
> Where do you want to create your new web site? [.]
> What will be the title of this web site? Micha's Tech Notes
> Who will be the author of this web site? Micha Kops
> What will be the default language of this web site? [C]
> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) Y
> What is your URL prefix? (see above example; no trailing slash) https
> Do you want to enable article pagination? (Y/n) n
> What is your time zone? [Europe/Rome]
> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n)
> Do you want to upload your website using FTP? (y/N)
> Do you want to upload your website using SSH? (y/N)
> Do you want to upload your website using Dropbox? (y/N)
> Do you want to upload your website using S3? (y/N)
> Do you want to upload your website using Rackspace Cloud Files? (y/N)
> Do you want to upload your website using GitHub Pages? (y/N)
Done. Your new project is available at /pelican-site
Creating a new Article
Now that the blog structure is there, let’s add a first article for our blog:
cat << EOF > content/rust-best-practices.md
Title: Rust best Practices
Date: 2010-12-03 10:20
Category: Article
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
EOF
Generating the Blog
We now use the same Docker image again to generate our blog:
docker container run --rm -v ${PWD}:/pelican-site ghcr.io/williamjacksn/pelican
Our directory structure looks like this now:
.
├── Makefile
├── content
│ └── rust-best-practices.md
├── output
│ ├── archives.html
│ ├── author
│ │ └── micha-kops.html
│ ├── authors.html
│ ├── categories.html
│ ├── category
│ │ ├── article.html
│ │ └── review.html
│ ├── index.html
│ ├── my-first-review.html
│ ├── rust-best-practices.html
│ ├── tags.html
│ └── theme
│ ├── css
│ │ ├── fonts.css
│ │ ├── main.css
│ │ ├── pygment.css
│ │ ├── reset.css
│ │ ├── typogrify.css
│ │ └── wide.css
│ └── fonts
│ ├── Yanone_Kaffeesatz_400.eot
│ ├── Yanone_Kaffeesatz_400.svg
│ ├── Yanone_Kaffeesatz_400.ttf
│ ├── Yanone_Kaffeesatz_400.woff
│ ├── Yanone_Kaffeesatz_400.woff2
│ ├── Yanone_Kaffeesatz_LICENSE.txt
│ └── font.css
├── pelicanconf.py
├── publishconf.py
└── tasks.py
We’re serving the website using Python:
cd output
python -m http.server
And now we’re ready to enjoy our website at http://localhost:8000