Browse Source

Provide a site title

master
Marien Fressinaud 6 years ago
parent
commit
c7b812c9f4
4 changed files with 15 additions and 6 deletions
  1. 4
    2
      Herisson/gallery.html.j2
  2. 3
    1
      Herisson/index.html.j2
  3. 7
    3
      boop.py
  4. 1
    0
      configuration.py

+ 4
- 2
Herisson/gallery.html.j2 View File

<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>

+ 3
- 1
Herisson/index.html.j2 View File

<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">

+ 7
- 3
boop.py View File



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):

+ 1
- 0
configuration.py View File

SITE_TITLE = "Balades européennes"
THEME = "Herisson" THEME = "Herisson"

Loading…
Cancel
Save