<meta charset="utf-8"> | <meta charset="utf-8"> | ||||
<meta name="viewport" content="initial-scale=1.0" /> | <meta name="viewport" content="initial-scale=1.0" /> | ||||
<link rel="stylesheet" href="style/main.css"> | <link rel="stylesheet" href="style/main.css"> | ||||
<title>{{ gallery.name }} · Boop</title> | |||||
<title>{{ gallery.name }} · {{ site_title }}</title> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<h1>{{ gallery.name }}</h1> | |||||
<h1><a href="index.html">{{ site_title }}</a></h1> | |||||
<h2>{{ gallery.name }}</h2> | |||||
{% for photo in gallery.photos %} | {% for photo in gallery.photos %} | ||||
<img src="{{ photo.url }}" alt="" /> | <img src="{{ photo.url }}" alt="" /> | ||||
<p>{{ photo.name }}</p> | <p>{{ photo.name }}</p> |
<meta charset="utf-8"> | <meta charset="utf-8"> | ||||
<meta name="viewport" content="initial-scale=1.0" /> | <meta name="viewport" content="initial-scale=1.0" /> | ||||
<link rel="stylesheet" href="style/main.css"> | <link rel="stylesheet" href="style/main.css"> | ||||
<title>Boop</title> | |||||
<title>{{ site_title }}</title> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<h1><a href="">{{ site_title }}</a></h1> | |||||
{% for gallery in galleries -%} | {% for gallery in galleries -%} | ||||
<div class="gallery"> | <div class="gallery"> | ||||
<a href="{{ gallery.url }}.html"> | <a href="{{ gallery.url }}.html"> |
from jinja2 import Environment, PackageLoader, select_autoescape | from jinja2 import Environment, PackageLoader, select_autoescape | ||||
from configuration import THEME | |||||
from configuration import SITE_TITLE, THEME | |||||
PICTURES_DIR_NAME = "photos" | PICTURES_DIR_NAME = "photos" | ||||
index_template = jinja_env.get_template("index.html.j2") | index_template = jinja_env.get_template("index.html.j2") | ||||
with open(index_path, "w") as index_file: | with open(index_path, "w") as index_file: | ||||
index_file.write(index_template.render(galleries=galleries)) | |||||
index_file.write( | |||||
index_template.render(galleries=galleries, site_title=SITE_TITLE) | |||||
) | |||||
def generate_gallery(output_path, gallery): | def generate_gallery(output_path, gallery): | ||||
gallery_template = jinja_env.get_template("gallery.html.j2") | gallery_template = jinja_env.get_template("gallery.html.j2") | ||||
with open(gallery_index_path, "w") as gallery_file: | with open(gallery_index_path, "w") as gallery_file: | ||||
gallery_file.write(gallery_template.render(gallery=gallery)) | |||||
gallery_file.write( | |||||
gallery_template.render(gallery=gallery, site_title=SITE_TITLE) | |||||
) | |||||
def generate_gallery_dir(output_path, gallery): | def generate_gallery_dir(output_path, gallery): |
SITE_TITLE = "Balades européennes" | |||||
THEME = "Herisson" | THEME = "Herisson" |