openfreebooks-bookgenerator/themes/openfreebooks/templates/chapter.html

68 lines
2.9 KiB
HTML

{% extends "base.html" %}
{% block title %}
{% set subject_catalog = load_data(path="data/math-curriculum.json", format="json") %}
{{ section.title }} | {{ subject_catalog.title }} | {{ config.extra.site_title }}
{% endblock title %}
{% block meta_description %}
<meta name="description" content="{{ section.description | default(value=config.description) }}" />
{% endblock meta_description %}
{% block extra_head %}
{% set subject = section.extra.subject %}
{% set slug = section.extra.chapter_id | default(value=section.slug) %}
{% set chapter_key = subject ~ "/" ~ slug %}
{% set chapters_meta = load_data(path="data/_generated/chapters-meta.json", format="json") %}
{% set subjects_meta = load_data(path="data/_generated/subjects-meta.json", format="json") %}
{% set chapter_meta = chapters_meta.chapters[chapter_key] %}
{% set subject_meta = subjects_meta.subjects[subject] | default(value=false) %}
{% if subject_meta and subject_meta.hasCss %}
<link rel="stylesheet" href="{{ get_url(path='css/subjects/' ~ subject ~ '.css', trailing_slash=false) | safe }}" />
{% endif %}
{% if chapter_meta.hasCss %}
<link rel="stylesheet" href="{{ get_url(path='css/chapters/' ~ subject ~ '-' ~ slug ~ '.css', trailing_slash=false) | safe }}" />
{% endif %}
{% endblock extra_head %}
{% block content %}
{% set subject = section.extra.subject %}
{% set slug = section.extra.chapter_id | default(value=section.slug) %}
{% set chapter_key = subject ~ "/" ~ slug %}
{% set subject_catalog = load_data(path="data/math-curriculum.json", format="json") %}
{% set catalog_subject_url = get_url(path="/catalog/") ~ "?subject=" ~ subject %}
<section class="book-page book-page--chapter">
<div class="container">
<nav class="book-breadcrumb" aria-label="Breadcrumb">
<a href="{{ get_url(path='/') | safe }}">Home</a>
<span class="book-breadcrumb__sep" aria-hidden="true">/</span>
<a href="{{ catalog_subject_url | safe }}">{{ subject_catalog.title }}</a>
<span class="book-breadcrumb__sep" aria-hidden="true">/</span>
<span aria-current="page">{{ section.title }}</span>
</nav>
<article
class="book-chapter"
data-pagefind-body
data-chapter="{{ chapter_key }}"
>
<header class="book-chapter__header">
<div class="book-chapter__header-main">
{% if section.extra.strand %}
<p class="section-kicker">{{ section.extra.strand }}</p>
{% endif %}
<h1 class="section-title">{{ section.title }}</h1>
{% if section.description %}
<p class="book-chapter__lead">{{ section.description }}</p>
{% endif %}
</div>
<div id="copy-page-button" class="book-chapter__actions" data-pagefind-ignore></div>
</header>
<div id="chapter-heading-nav" data-pagefind-ignore></div>
{{ section.content | safe }}
{% include "partials/chapter-footer-nav.html" %}
</article>
</div>
</section>
{% endblock content %}