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-themes
Additionally the repository includes the following:
/output: content that is served on theelections.pyladies.comvia GitHub actions on thegh-pagesbranch (see.github/workflows/build_deploy.yml)
To start you'll need to:
-
Clone the repo:
- If you have git 2.11+:
git clone --recurse-submodules https://github.com/pyladies/pyladies-elections-website
- Otherwise run:
git clone --recursive https://github.com/pyladies/pyladies-elections-website
- If you have git 2.11+:
-
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
makeinstead 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:
- Checkout the submodules with the pelican theme (
/pelican-fh5co-marble) and plugin (/pelican-fh5co-marble) - Install the
requirements.txt - Run
pelican contentto repopulate/output - Push
/ouputtogh-pagesto host the content via GitHub pages
Navigate 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 -vpoints 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_branchTo add additional languages in the website the following changes are required:
pelicanconf.py
I18N_SUBSITESdict with a key representing the 2 character language code (e.g.esfor espanol) and specify:PAGE_PATHSthis is the route that will be generated for the content pages e.g.localhost:8000/pages/esARTICLE_PATHSthis is the route that will be generated for the articles e.g.localhost:8000/blog/esLOCALEwith the two language character code and country e.g.es_ES
HEROlist of image dicts:titleof each image with the same 2 character language code e.g.esfor espanollinkslist of eachtextkey with the same 2 character language code e.g.esfor espanol
-
Add 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