The PyLadies Election page is a Python 3 pelican powered website. This repository includes the pelican theme and code to generate the static files that are served via the pyladies.github.io/elections GitHub project page.
This repository includes the following submodules:
/pelican-plugins
: points to the main pelican-plugins repo/pelican-fh5co-marble
: points to a fork of the theme fetched from pelican-themesAdditionally the repository includes the following:
/output
: content that is served on the elections.pyladies.com
via GitHub actions on the gh-pages
branch (see .github/workflows/build_deploy.yml
)To start you'll need to:
Clone the repo:
git clone --recurse-submodules https://github.com/pyladies/pyladies-elections-website
git clone --recursive https://github.com/pyladies/pyladies-elections-website
Setup and activate a virtual environment:
python3 -m venv .ENV
source .ENV/bin/activate
Install pip install -r requirements.txt
.
Generate pelican content and serve locally with:
pelican content
pelican --listen
Alternatively, you can use make
instead of Pelican commands:
make html
make serve
Whenever a push action is issued again main
GitHub Actions will run the build_deploy.yml
workflow to:
/pelican-fh5co-marble
) and plugin (/pelican-fh5co-marble
)requirements.txt
pelican content
to repopulate /output
/ouput
to gh-pages
to host the content via GitHub pagesNavigate to elections.pyladies.com to confirm the changes are live.
$ git submodule
$ 700eb3b435f18ef0ca9b7bdf7f8ca0a3d59f2e46 pelican-fh5co-marble (v1.0.1-25-g700eb3b)
$ f191788fe0bf3cae54f22b5b447dd23b8d32364e pelican-plugins (heads/master)
This confirms the latest commit the repository has checked out for each of the submodules: the theme (pelican-fh5co-marble
) as well as the plugins (pelican-plugins
).
Example of initializing the /pelican-fh5co-marble
submodule:
cd /pelican-fh5co-marble
Confirm git remote -v
points to proper repo
git remote -v
origin https://github.com/pyladies/pelican-fh5co-marble (fetch)
origin https://github.com/pyladies/pelican-fh5co-marble (push)
If the submodule remote doesn't exist:
git submodule update --init
The workflow is the same as working in a standard repository, if updating the pelican-fh5co-marble
submodule:
$ cd /pelican-fh5co-marble
$ git status
$ git add <FILES_CHANGED>
$ git commit -m "Meaningful message"
$ git push origin main
$ cd ../
$ git add pelican-fh5co-marble
$ git commit -m "Updated submodule"
$ git push origin feature_branch
To add additional languages in the website the following changes are required:
pelicanconf.py
I18N_SUBSITES
dict with a key representing the 2 character language code (e.g. es
for espanol) and specify:
PAGE_PATHS
this is the route that will be generated for the content pages e.g. localhost:8000/pages/es
ARTICLE_PATHS
this is the route that will be generated for the articles e.g. localhost:8000/blog/es
LOCALE
with the two language character code and country e.g. es_ES
HERO
list of image dicts:
title
of each image with the same 2 character language code e.g. es
for espanollinks
list of each text
key with the same 2 character language code e.g. es
for espanolAdd your markdown pages into content/pages/<LANGUAGE CHARACTER CODE>
.
Each page should include the following metadata, Title
, Order
, Date
, Icon
, Summary
, Lang
, Slug
. Here is an example the Aplica page in Spanish:
Title: Aplica
Order: 5
Date: 2020-04-09 10:30
Icon: icon-link2
Summary: Cómo convertirse en miembro del Consejo Global de PyLadies
Lang: es
Slug: aplica