# Paged.js in a jinja template
This script shows a recipe for making a paged.js publication with Python. To avoid having to write all the HTML in the python script it uses the jinja templating engine.
## Installation
First, clone, or download a copy of this repository.
### Python 3
The script uses Python 3. If you know you have it installed this step can be skipped. If you are not sure whether it is installed on your computer, run the following command in the terminal:
```bash
python3 --version
```
It should output the version number of the copy of Python you have installed, something like:
```
3.10.7
```
If the terminal instead prints something like:
```
Command 'python3' not found...
```
It is most likely Python isn't installed. You can [download it, and find installation instructions here](https://www.python.org/downloads/).
### Jinja
```python
pip3 install jinja2
```
## Running the script
Running the script should result in the folder of the script: `index.html` this file is based on the template `templates/template.html`.
*When using the terminal*: The script can be ran by first using `cd` to move into the folder of the script. The easiest way is typing `cd` and a space and then drag and drop the folder onto the terminal. Then press enter. Once you are in the folder, type:
```bash
python3 render-template.py
```
## Seeing the result
The generated HTML file can simply be opened in a web browser.
Pages using paged.js *and* an external styles file need to be opened through a local server.
It is quite possible your editor has this functionality built in and it is perfectly fine to use that.
Python also has a simple server built in. To start it, first `cd` into the folder of your project. Then run:
```bash
python3 -m http.server
```
The output should be something like:
```
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
```
Indicating a server has been started and is listening for requests on port 8000.
Open a webbrowser and open the address