added breadcrumbs
This commit is contained in:
parent
08e7e343f5
commit
d3ff002901
@ -21,6 +21,19 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{% if breadcrumbs|length %}
|
||||
<!-- Breadcrumbs Section -->
|
||||
<nav class="breadcrumb is-small has-succeeds-separator p-3" aria-label="breadcrumbs">
|
||||
<ul>
|
||||
{% for b in breadcrumbs %}
|
||||
<li class="{{'is-active' if b.slug == slug}}">
|
||||
<a {{'aria-current="page"' if b.slug == slug}} href="{{b.url}}">{{b.name}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<section class="section">
|
||||
{% if translations|length %}
|
||||
<div class="container content">
|
||||
|
@ -23,6 +23,19 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{% if breadcrumbs|length %}
|
||||
<!-- Breadcrumbs Section -->
|
||||
<nav class="breadcrumb is-small has-succeeds-separator p-3" aria-label="breadcrumbs">
|
||||
<ul>
|
||||
{% for b in breadcrumbs %}
|
||||
<li class="{{'is-active' if b.slug == slug}}">
|
||||
<a {{'aria-current="page"' if b.slug == slug}} href="{{b.url}}">{{b.name}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<!-- Main Content -->
|
||||
<section class="section">
|
||||
<div class="content">
|
||||
|
@ -246,6 +246,7 @@ class ArticleTranslation:
|
||||
|
||||
# get children
|
||||
self.context["children"] = self.article.child_articles.get_translated(self.language_code).context
|
||||
self.context["breadcrumbs"] = ArticleList(self.article.article_path).get_translated(self.language_code).context
|
||||
|
||||
def __init_content_context__(self):
|
||||
template = jinja2.Template(self.html_content)
|
||||
@ -388,6 +389,7 @@ class Article:
|
||||
# recursive context structures
|
||||
self.context["translations"] = [c.context for c in self.article_translations_list]
|
||||
self.context["children"] = self.child_articles.context
|
||||
self.context["breadcrumbs"] = [b.context for b in self.article_path]
|
||||
for lang, article in self.article_translations_map.items():
|
||||
self.context[lang] = article.context
|
||||
|
||||
@ -448,6 +450,7 @@ def build():
|
||||
tree.__init_context__()
|
||||
tree.__init_content_context__()
|
||||
|
||||
"""
|
||||
import json
|
||||
with Path("context.json").open("w") as f:
|
||||
json.dump(tree.context, f, indent=4)
|
||||
@ -455,6 +458,7 @@ def build():
|
||||
json.dump(CROSS_ARTICLE_CONTEXT, f, indent=4)
|
||||
with Path("t_cross_article_context.json").open("w") as f:
|
||||
json.dump(TRANSLATED_CROSS_ARTICLE_CONTEXT, f, indent=4)
|
||||
|
||||
"""
|
||||
|
||||
logger.info("dumping page tree...")
|
||||
tree.build()
|
||||
|
@ -20,6 +20,7 @@ class ArticleContext(TypedDict):
|
||||
|
||||
translations: List[ArticleTranslationContext]
|
||||
children: List[ArticleContext]
|
||||
breadcrumbs: List[ArticleContext]
|
||||
linked: List[ArticleContext]
|
||||
related: List[ArticleContext]
|
||||
|
||||
@ -50,6 +51,7 @@ class ArticleTranslationContext(TypedDict):
|
||||
config.fall_back_to_overview_in_translation = False
|
||||
"""
|
||||
children: List[Union[ArticleTranslationContext, ArticleContext]]
|
||||
breadcrumbs: List[Union[ArticleTranslationContext, ArticleContext]]
|
||||
|
||||
# you can't use these within the markdown text itself
|
||||
content: str
|
||||
|
Loading…
x
Reference in New Issue
Block a user