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

44 lines
1.7 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ page.title }} | {{ config.extra.site_title }}{% endblock title %}
{% block meta_description %}
<meta name="description" content="Browse Open Free Books chapters by subject and curriculum." />
{% endblock meta_description %}
{% block content %}
{% set catalog = load_data(path="data/catalog.json", format="json") %}
{% set math_catalog = load_data(path="data/math-curriculum.json", format="json") %}
<script id="catalog-data" type="application/json">
{
"title": {{ catalog.title | json_encode() | safe }},
"subtitle": {{ catalog.subtitle | json_encode() | safe }},
"curriculums": {{ catalog.curriculums | json_encode() | safe }},
"subjects": [
{% for subject in catalog.subjects %}
{
"id": {{ subject.id | json_encode() | safe }},
"name": {{ subject.name | json_encode() | safe }}{% if subject.banner %},
"banner": {{ subject.banner | json_encode() | safe }}{% endif %},
"strands": {% if subject.id == "math" %}{{ math_catalog.strands | json_encode() | safe }}{% else %}[]{% endif %}{% if subject.id == "math" and math_catalog.graph %},
"graph": {{ math_catalog.graph | json_encode() | safe }}{% endif %}
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}
</script>
<noscript>
<div class="catalog-page">
<div class="container">
<h1 class="section-title">{{ catalog.title }}</h1>
<p>{{ catalog.subtitle }}</p>
<p>
JavaScript is required for the interactive catalog. You can read
<a href="{{ get_url(path='/catalog/') | safe }}?subject=math">Mathematics in the catalog</a> directly.
</p>
</div>
</div>
</noscript>
<div id="catalog-app" class="catalog-page"></div>
{% endblock content %}