Switch from Pelican to Zola

Updated articles accordingly
Updated new_article script
Changed README
Added Zola 'section indexes'
Added Zulma theme submodule

Removed everything related to Pelican
This commit is contained in:
Teo-CD 2020-10-03 00:45:33 +02:00
parent 4e1a027482
commit 80c9cadefa
21 changed files with 131 additions and 217 deletions

5
.gitignore vendored
View file

@ -1,5 +1,4 @@
__pycache__/
output/
publishconf.py
tasks.py
public/
*.swp
*.zip

10
.gitmodules vendored
View file

@ -1,7 +1,3 @@
[submodule "themes/Flex"]
path = themes/Flex
url = https://github.com/lpenaud/Flex/
branch = toc-style
[submodule "plugins/pelican-toc"]
path = plugins/pelican-toc
url = https://github.com/ingwinlu/pelican-toc/
[submodule "themes/Zulma"]
path = themes/Zulma
url = git@git.tfk-astrodome.net:Teo-CD/Zulma-Theme.git

View file

@ -1,75 +0,0 @@
PY?=python3
PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif
RELATIVE ?= 0
ifeq ($(RELATIVE), 1)
PELICANOPTS += --relative-urls
endif
help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@echo ' make regenerate regenerate files upon modification '
@echo ' make publish generate using production settings '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
@echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
@echo ' make devserver [PORT=8000] serve and regenerate together '
@echo ' make ssh_upload upload the web site via SSH '
@echo ' make rsync_upload upload the web site via rsync+ssh '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
@echo 'Set the RELATIVE variable to 1 to enable relative urls '
@echo ' '
html:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
clean:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
regenerate:
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
serve:
ifdef PORT
$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
else
$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
endif
serve-global:
ifdef SERVER
$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b $(SERVER)
else
$(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0
endif
devserver:
ifdef PORT
$(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
else
$(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
endif
publish:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
.PHONY: html help clean regenerate serve serve-global devserver publish

View file

@ -1,26 +1,15 @@
# TFK-Blog
This is the sources for my blog.
They are generated using Pelican and based on the Flex theme.
They are generated using [Zola](https://www.getzola.com) and based on custom changes of the [Zulma](https://www.getzola.org/themes/zulma/) theme.
## Prerequisites
Python dependencies :
- pelican[Markdown]
- typogrify
- beautifulsoup4 (Maybe ? Was already pulled for me)
You can install everything by running the following command :
`sudo pip3 install pelican[Markdown] typogrify beautifulsoup4`
You only need Zola installed on your system, check the instructions [on their site](https://www.getzola.org/documentation/getting-started/installation/).
## Build
To generate the site, you have to setup the pelican project :
`pelican-quickstart`
Then, check that the `pelicanconf.py` file has not been changed. If it has, replace it.
You can now generate the site by running `make html` and test it on your local machine, port 8000, by running `make serve`.
To test the site locally, you can run `zola serve` at the root of the repository (After the submodule for the theme has been set up). If you run the `zola build` command, the site will be build and output in the `public` directory.
## Write

41
config.toml Normal file
View file

@ -0,0 +1,41 @@
# The URL the site will be built for
base_url = "https://tfk-astrodome.net"
title = "L'Astrodome"
# Whether to automatically compile all Sass files in the sass directory
compile_sass = true
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = true
# Whether to build a search index to be used later on by a JavaScript library
build_search_index = true
taxonomies = [
{name = "categories", lang = "en"},
{name = "categories", lang = "fr"},
{name = "tags", lang = "en"},
{name = "tags", lang = "fr"},
]
theme = "Zulma"
generate_feed = true
default_language = "en"
languages = [
{code = "fr", feed = true},
]
[extra]
zulma_menu = [
{url = "$BASE_URL/categories", name = "Categories"},
{url = "$BASE_URL/tags", name = "Tags"},
{url = "$BASE_URL/atom.xml", name = "Feed"},
{url = "$BASE_URL/about", name = "About"},
]
zulma_brand = {image = "$BASE_URL/images/lidar.png", text = "L'astrodome"}
zulma_title = "L'Astrodome"
zulma_theme = "darkly"

3
content/_index.fr.md Normal file
View file

@ -0,0 +1,3 @@
+++
sort_by = "date"
+++

3
content/_index.md Normal file
View file

@ -0,0 +1,3 @@
+++
sort_by = "date"
+++

View file

@ -1,7 +1,9 @@
Title: About
Date: 2020-05-31 19:20
Slug: about
toc_run: false
+++
title = "À propos"
date = 2020-05-31
updated = 2020-10-02
path = "fr/about"
+++
# Bienvenue !
@ -13,12 +15,14 @@ solutions, écrits, réflexions et tout autre chose écrite qui peut intéresser
Il se présente donc sous la forme d'un blog (dont vous prouvez trouver les sources
[ici](https://git.tfk-astrodome.net/Teo-CD/TFK-Blog)) pas forcément structuré ou plannifié,
mais (idéalement) au moins organisé par catégorie/thème !
mais (idéalement) au moins organisé par catégorie/thème !
Ce blog est créé grâce à [Zola](https://www.getzola.org/) et utilise le thème [Zulma](https://www.getzola.org/themes/zulma/) modifié par mes soins.
## Ce bonhomme
Moi c'est trotFunky (Abrégé `trot`. Ou alors Téo, mais trotFunky c'est bien).
Jeune français de 98 (plus pratique que garder un âge à jour),
Jeune français de 1998 (plus pratique que garder un âge à jour),
(bientôt) ingénieur diplômé de l'[Institut Polytechnique de Paris](https://www.ip-paris.fr/)
qui s'amuse à bidouiller, programmer et faire du jeu de rôle.
Développeur bas-niveau du club de robotique INTech pendant trois ans. Visiblement, blogger.

View file

@ -1,8 +1,9 @@
Title: About
Date: 2020-05-31 19:41
Slug: about
lang: en
toc_run: false
+++
title = "About"
date = 2020-05-31
updated = 2020-10-02
path = "about"
+++
# Welcome !
@ -16,6 +17,9 @@ Thus I chose to make it a blog (the sources of which can be found
[here](https://git.tfk-astrodome.net/Teo-CD/TFK-Blog)) which might not be well structued
or planned but -- idealy -- at least organized by category/theme !
This blog is created with [Zola](https://www.getzola.org/) an uses a custom version of the [Zulma](https://www.getzola.org/themes/zulma/) theme.
## This guy
I'm trotFunky (Shortened `trot`. Or Téo, but trotFunky is alright). I'm a French guy,

View file

@ -1,9 +1,13 @@
Title: Premiers pas
Date: 2020-05-31 20:40
Category: Blog
Tags:
Slug: first-steps
Summary: C'est le début d'une nouvelle aventure !
+++
title = "Premiers pas"
date = 2020-05-31
[taxonomies]
categories = ["Blog"]
+++
C'est le début d'une nouvelle aventure !
<!-- more -->
Cela fait longtemps que ça me trottait en tête mais le moment est venu : il est temps de
se mettre à écrire ! J'ai plusieurs fois eu des problèmes que j'ai du rechercher plusieurs

View file

@ -1,10 +1,13 @@
Title: First steps
Date: 2020-05-31 20:45
Category: Blog
Tags:
lang: en
Slug: first-steps
Summary: This is the start of a new adventure !
+++
title = "First steps"
date = 2020-05-31
[taxonomies]
categories = ["Blog"]
+++
This is the start of a new adventure !
<!-- more -->
Starting writing has been on my list for a long time : the time is now ! Multiple times
I had to search for a solution to the same problem twice or even wanted to keep a record

View file

@ -1,15 +1,17 @@
Title: À l'aventure avec bspwm
Date: 21-06-2020 00:11
Modified: 21-06-2020 17:50
Category: *nix
Tags: Desktop, WM, bspwm
Lang: fr
Slug: jumping-into-bspwm
Status: draft
Summary: Il était temps que je me frotte à un gestionnaire de fenêtre "en tuiles", je me suis donc lancé avec bspwm.
+++
title = "À l'aventure avec bspwm"
date = 2020-06-21
updated = 2020-06-21
draft = true
[taxonomies]
categories = ["*nix"]
tags = ["Desktop", "WM", "bspwm"]
+++
Il était temps que je me frotte à un gestionnaire de fenêtre "en tuiles", je me suis donc lancé avec bspwm.
<!-- more -->
# Pourquoi ?
Ça fait bientôt 5 ans que Linux a prit de l'importance comme mon OS quotidien, et de plus en plus ces trois dernières années. Pendant tout ce temps mon environnement de bureau (**DE**) principal a été GNOME : l'option de base de Debian, plutôt commun et que j'ai suffisamment personnalisé pour en faire mon "chez moi". Du coup pourquoi changer ?

View file

@ -0,0 +1,5 @@
+++
title = "La grosse liste des articles!"
sort_by = "date"
transparent = true
+++

View file

@ -0,0 +1,5 @@
+++
title = "The great list of all the articles!"
sort_by = "date"
transparent = true
+++

View file

@ -1,3 +0,0 @@
aside nav ul li {
text-transform: none;
}

View file

@ -7,8 +7,9 @@ append_to_metadata() {
if [ $# -eq 2 ]; then
echo -n "$2 : "
read answer
option="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
if [ -n "$answer" ]; then
echo "$2: ""$answer" >> "content/articles/$1"
echo "$option = ""$answer" >> "content/articles/$1"
else
echo "Empty answer, nothing was appended"
fi
@ -18,21 +19,27 @@ append_to_metadata() {
echo -n "Filename : "
read filename
echo "+++" > content/articles/"$filename"
echo "The title must be between quotes"
append_to_metadata "$filename" "Title"
append_to_metadata "$filename" "Date"
append_to_metadata "$filename" "Category"
append_to_metadata "$filename" "Tags"
append_to_metadata "$filename" "Lang"
append_to_metadata "$filename" "Draft"
append_to_metadata "$filename" "Slug"
append_to_metadata "$filename" "Summary"
echo "[taxonomies]" >> content/articles/"$filename"
echo -e "\n" >> content/articles/"$filename"
echo "Categories and tag must be formatted as follows : [\"element1\",\"element2\"]"
append_to_metadata "$filename" "Categories"
append_to_metadata "$filename" "Tags"
echo -e "+++\n\n" >> content/articles/"$filename"
# Try to get the default editor from alternatives
EDITOR=${EDITOR:-$(update-alternatives --list editor | head -n1)}

View file

@ -1,72 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
from datetime import datetime
AUTHOR = 'trotFunky'
SITENAME = "L'Astrodome"
SITETITLE = "L'Astrodome"
SITESUBTITLE = "Un point d'observation de mon univers"
SITELOGO = "/images/Profile.png"
SITEURL = 'https://tfk-astrodome.net'
CC_LICENSE = {
'name': 'Creative Commons Attribution-ShareAlike',
'version': '4.0',
'slug': 'by-sa'
}
COPYRIGHT_YEAR = datetime.now().year
PATH = 'content'
PLUGIN_PATHS = ["plugins"]
STATIC_PATHS = ['extras/custom.css','images/']
# tell pelican where it should copy that file to in your output folder
EXTRA_PATH_METADATA = {
'extras/custom.css': {'path': 'static/custom.css'},
}
CUSTOM_CSS = 'static/custom.css'
PLUGINS = ["pelican-toc"]
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = 'fr'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml'
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
# Blogroll
LINKS = (("Categories", SITEURL+'/categories.html'),)
# Social widget
SOCIAL = (('rss', SITEURL+'/feeds/all.atom.xml'),)
DEFAULT_PAGINATION = False
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
MAIN_MENU = False
LOCALE = ('fr_FR', 'en_US')
TYPOGRIFY = True
THEME = "themes/Flex"
# Flex theme
TOC_FLOAT = 'right'
TOC = {
'TOC_HEADERS' : '^h[1-6]',
'TOC_RUN' : 'true',
'TOC_INCLUDE_TITLE' : 'false',
}
THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE = True
THEME_COLOR_ENABLE_USER_OVERRIDE = True

@ -1 +0,0 @@
Subproject commit b98d89b2cfa857c59b647ef0983a470408d6d8cd

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

@ -1 +0,0 @@
Subproject commit 077d47986154e82c97bebff5c9fb280d544887fa

1
themes/Zulma Submodule

@ -0,0 +1 @@
Subproject commit 39cffcefc7b094932dbf0a5fbbf1a54f40ba6194