Add subproject templates #2
This commit is contained in:
parent
ccda2a5047
commit
d30fd2b007
@ -131,6 +131,7 @@ show_repo = true
|
|||||||
# See https://www.getzola.org/documentation/content/linking/#internal-links
|
# See https://www.getzola.org/documentation/content/linking/#internal-links
|
||||||
links = [
|
links = [
|
||||||
{ url = "@/blog/_index.md", name = "Blog" },
|
{ url = "@/blog/_index.md", name = "Blog" },
|
||||||
|
{ url = "@/subprojects/_index.md", name = "Subprojects" },
|
||||||
{ url = "@/demo/index.md", name = "Demo" },
|
{ url = "@/demo/index.md", name = "Demo" },
|
||||||
{ url = "https://mastodon.de/@david_swift", name = "Developer" }
|
{ url = "https://mastodon.de/@david_swift", name = "Developer" }
|
||||||
]
|
]
|
||||||
@ -140,6 +141,7 @@ links = [
|
|||||||
# Same as the nav ones.
|
# Same as the nav ones.
|
||||||
links = [
|
links = [
|
||||||
{ url = "@/blog/_index.md", name = "Blog" },
|
{ url = "@/blog/_index.md", name = "Blog" },
|
||||||
|
{ url = "@/subprojects/_index.md", name = "Subprojects" },
|
||||||
{ url = "@/demo/index.md", name = "Demo" },
|
{ url = "@/demo/index.md", name = "Demo" },
|
||||||
{ url = "https://mastodon.de/@david_swift", name = "Developer" }
|
{ url = "https://mastodon.de/@david_swift", name = "Developer" }
|
||||||
]
|
]
|
||||||
|
|||||||
7
content/subprojects/_index.md
Normal file
7
content/subprojects/_index.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
+++
|
||||||
|
title = "Subprojects"
|
||||||
|
template = "subproject_list.html"
|
||||||
|
page_template = "subproject.html"
|
||||||
|
+++
|
||||||
|
|
||||||
|
Subprojects can be used for different purposes, such as a showcase of a project's features. So, here are some of Duckling's features!
|
||||||
10
content/subprojects/blog/index.md
Normal file
10
content/subprojects/blog/index.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
+++
|
||||||
|
title = "Blogs"
|
||||||
|
description = "Duckling offers the blogs feature borrowed from Duckquill 🦆"
|
||||||
|
date = 2023-08-31
|
||||||
|
updated = "2024-06-21"
|
||||||
|
[taxonomies]
|
||||||
|
tags = ["Demo", "Test"]
|
||||||
|
+++
|
||||||
|
|
||||||
|
Check out the [sample blog](/blog) to see the blogging feature in action!
|
||||||
10
content/subprojects/docs/index.md
Normal file
10
content/subprojects/docs/index.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
+++
|
||||||
|
title = "Documentation"
|
||||||
|
description = "No need for a separate documentation page - coming soon!"
|
||||||
|
date = 2023-08-31
|
||||||
|
updated = "2024-06-21"
|
||||||
|
[taxonomies]
|
||||||
|
tags = ["Demo", "Test"]
|
||||||
|
+++
|
||||||
|
|
||||||
|
This feature is not yet implemented. Coming soon!
|
||||||
12
content/subprojects/subproject/index.md
Normal file
12
content/subprojects/subproject/index.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
+++
|
||||||
|
title = "Subprojects"
|
||||||
|
description = "Showcase parts of your project!"
|
||||||
|
date = 2023-08-31
|
||||||
|
updated = "2024-06-21"
|
||||||
|
[taxonomies]
|
||||||
|
tags = ["Demo", "Test"]
|
||||||
|
+++
|
||||||
|
|
||||||
|
I'm an example for a subproject!
|
||||||
|
|
||||||
|
The [subprojects page](/subprojects) shows multiple subprojects in a grid.
|
||||||
67
templates/partials/subprojects.html
Normal file
67
templates/partials/subprojects.html
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{%- if paginator.pages -%}
|
||||||
|
{%- set pages = paginator.pages -%}
|
||||||
|
{%- elif section.pages -%}
|
||||||
|
{%- set pages = section.pages -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set pages = term.pages -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div id="article-list">
|
||||||
|
{%- for page in pages %}
|
||||||
|
{%- if page.draft -%}
|
||||||
|
{%- set article_type = "draft" -%}
|
||||||
|
{%- set article_string = macros_translate::translate(key="drafted", default="Drafted", language_strings=language_strings) -%}
|
||||||
|
{%- elif page.extra.archive -%}
|
||||||
|
{%- set article_type = "archive" -%}
|
||||||
|
{%- set article_string = macros_translate::translate(key="archived", default="Archived", language_strings=language_strings) -%}
|
||||||
|
{%- elif page.extra.featured -%}
|
||||||
|
{%- set article_type = "featured" -%}
|
||||||
|
{%- set article_string = macros_translate::translate(key="featured", default="Featured", language_strings=language_strings) -%}
|
||||||
|
{%- elif page.extra.hot -%}
|
||||||
|
{%- set article_type = "hot" -%}
|
||||||
|
{%- set article_string = macros_translate::translate(key="hot", default="Hot", language_strings=language_strings) -%}
|
||||||
|
{%- elif page.extra.poor -%}
|
||||||
|
{%- set article_type = "poor" -%}
|
||||||
|
{%- set article_string = macros_translate::translate(key="poor", default="Poor", language_strings=language_strings) -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if page.extra.banner -%}
|
||||||
|
{%- set blurnail = resize_image(path=page.colocated_path ~ page.extra.banner, width=4, height=2, op="fill", format="webp") -%}
|
||||||
|
{%- endif -%}
|
||||||
|
<article {% if article_type %}class="{{ article_type }}"{% endif %} {% if blurnail %}style="--blurnail: url('{{ blurnail.url }}')"{% endif %}>
|
||||||
|
<a href="{{ page.permalink | safe }}"></a>
|
||||||
|
{% if article_type %}
|
||||||
|
<span class="badge">
|
||||||
|
<i class="icon"></i>
|
||||||
|
{{- article_string -}}
|
||||||
|
</span>
|
||||||
|
{%- endif %}
|
||||||
|
<h3>{{ page.title }}</h3>
|
||||||
|
{%- if page.description %}
|
||||||
|
{{ page.description | markdown | safe }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if page.date -%}
|
||||||
|
<div class="details">
|
||||||
|
<small>
|
||||||
|
<time datetime="{{ page.date | date(format='%+') }}" pubdate>
|
||||||
|
{{- page.date | date(format=date_format, locale=date_locale) -}}
|
||||||
|
</time>
|
||||||
|
{%- if page.authors -%}
|
||||||
|
<span> {{ config.extra.separator | default(value="•") }} {% include "partials/authors.html" -%}</span>
|
||||||
|
{%- endif -%}
|
||||||
|
</small>
|
||||||
|
{%- if page.taxonomies -%}
|
||||||
|
{%- for name, taxon in page.taxonomies %}
|
||||||
|
<small>
|
||||||
|
<ul class="tags">
|
||||||
|
{%-for item in taxon -%}
|
||||||
|
<li><a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a></li>
|
||||||
|
{%- endfor %}
|
||||||
|
</ul>
|
||||||
|
</small>
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif %}
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
</article>
|
||||||
|
{%- endfor %}
|
||||||
|
</div>
|
||||||
158
templates/subproject.html
Normal file
158
templates/subproject.html
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{%- set date_format = macros_translate::translate(key="date_format", default="%B %d, %Y", language_strings=language_strings) -%}
|
||||||
|
{%- set date_locale = macros_translate::translate(key="date_locale", default="en_US", language_strings=language_strings) -%}
|
||||||
|
{%- set rel_attributes = macros_rel_attributes::rel_attributes() | trim -%}
|
||||||
|
|
||||||
|
{%- if page.extra.toc_ordered or section.extra.toc_ordered or config.extra.toc_ordered -%}
|
||||||
|
{%- set list_element = "ol" -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set list_element = "ul" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<article>
|
||||||
|
{%- if page.extra.banner -%}
|
||||||
|
<div id="banner-container">
|
||||||
|
<img id="banner" class="full-bleed{% if page.extra.banner_pixels %} pixels{% endif %}" src="{{ current_url ~ page.extra.banner }}" {% if config.markdown.lazy_async_image %}decoding="async" loading="lazy"{% endif %} />
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div id="heading">
|
||||||
|
{%- if page.date -%}
|
||||||
|
<p>
|
||||||
|
<small>
|
||||||
|
<time datetime="{{ page.date | date(format=' %+') }}">
|
||||||
|
{{- macros_translate::translate(key="published", default="Published on", language_strings=language_strings) }}
|
||||||
|
{{ page.date | date(format=date_format, locale=date_locale) -}}
|
||||||
|
</time>
|
||||||
|
{%- if page.updated -%}
|
||||||
|
<span> {{ config.extra.separator | default(value="•") }} </span>
|
||||||
|
<time datetime="{{ page.updated | date(format=' %+') }}">
|
||||||
|
{{- macros_translate::translate(key="updated", default="Updated on", language_strings=language_strings) }}
|
||||||
|
{{ page.updated | date(format=date_format, locale=date_locale) -}}
|
||||||
|
</time>
|
||||||
|
{%- endif -%}
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<h1>{{ page.title }}</h1>
|
||||||
|
|
||||||
|
{%- if page.authors or config.extra.show_reading_time -%}
|
||||||
|
<p>
|
||||||
|
<small>
|
||||||
|
{%- if page.authors -%}
|
||||||
|
<span>{% include "partials/authors.html" -%}</span>
|
||||||
|
{%- if config.extra.show_reading_time -%}
|
||||||
|
<span> {{ config.extra.separator | default(value="•") }} </span>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if config.extra.show_reading_time -%}
|
||||||
|
<span>{{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}</span>
|
||||||
|
{%- if page.taxonomies -%}
|
||||||
|
<span> {{ config.extra.separator | default(value="•") }} </span>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if page.taxonomies -%}
|
||||||
|
{%- for name, taxon in page.taxonomies %}
|
||||||
|
<ul class="tags">
|
||||||
|
{%-for item in taxon -%}
|
||||||
|
<li><a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a></li>
|
||||||
|
{%- endfor %}
|
||||||
|
</ul>
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="buttons-container">
|
||||||
|
{%- if page.extra.toc and page.toc | length > 0 -%}
|
||||||
|
<details id="toc" class="closable">
|
||||||
|
<summary title="{{ macros_translate::translate(key='table_of_contents', default='Table of Contents', language_strings=language_strings) }}"><i class="icon"></i></summary>
|
||||||
|
<div>
|
||||||
|
<strong class="title">{{ macros_translate::translate(key="table_of_contents", default="Table of Contents", language_strings=language_strings) }}</strong>
|
||||||
|
<div>
|
||||||
|
<{{ list_element }}>
|
||||||
|
{%- for h1 in page.toc -%}
|
||||||
|
<li>
|
||||||
|
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
|
||||||
|
{%- if h1.children -%}
|
||||||
|
<{{ list_element }}>
|
||||||
|
{%- for h2 in h1.children -%}
|
||||||
|
<li>
|
||||||
|
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
|
||||||
|
</li>
|
||||||
|
{%- endfor -%}
|
||||||
|
</{{ list_element }}>
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{%- endfor -%}
|
||||||
|
</{{ list_element }}>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if config.extra.show_backlinks and page.backlinks | length > 0 -%}
|
||||||
|
<details id="backlinks" class="closable">
|
||||||
|
<summary title="{{ macros_translate::translate(key='backlinks', default='Backlinks', language_strings=language_strings) }}"><i class="icon"></i></summary>
|
||||||
|
<div>
|
||||||
|
<strong class="title">{{ macros_translate::translate(key="backlinks", default="Backlinks", language_strings=language_strings) }}</strong>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
{%- for backlink in page.backlinks -%}
|
||||||
|
<li>
|
||||||
|
<a href="{{ backlink.permalink }}">{{ backlink.title }}</a>
|
||||||
|
</li>
|
||||||
|
{%- endfor -%}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
{%- endif -%}
|
||||||
|
<a id="go-to-top" href="#top" title="{{ macros_translate::translate(key='go_to_top', default='Go to Top', language_strings=language_strings) }}"><i class="icon"></i></a>
|
||||||
|
{%- if config.extra.show_share_button -%}
|
||||||
|
<a id="share" href="https://shareopenly.org/share/?url={{ page.permalink }}{% if page.description %}&text={{ page.description | urlencode }}{% endif %}" rel="{{ rel_attributes }}" title="{{ macros_translate::translate(key='share', default='Share', language_strings=language_strings) }}"><i class="icon"></i></a>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if config.extra.issues_url -%}
|
||||||
|
<a id="issue" href="{{ config.extra.issues_url }}" rel="{{ rel_attributes }}" title="{{ macros_translate::translate(key='file_an_issue', default='File an Issue', language_strings=language_strings) }}"><i class="icon"></i></a>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%- include "partials/statements.html" -%}
|
||||||
|
|
||||||
|
{%- if page.extra.toc_inline -%}
|
||||||
|
{%- include "partials/toc.html" -%}
|
||||||
|
{%- elif config.extra.toc_inline -%}
|
||||||
|
{%- include "partials/toc.html" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{{ page.content | safe }}
|
||||||
|
</article>
|
||||||
|
|
||||||
|
{%- if page.extra.comments.id -%}
|
||||||
|
{%- include "partials/comments.html" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if page.lower or page.higher -%}
|
||||||
|
<hr />
|
||||||
|
<nav id="post-nav">
|
||||||
|
{%- if page.higher -%}
|
||||||
|
<a class="post-nav-item post-nav-prev" href="{{ page.higher.permalink }}">
|
||||||
|
<div class="nav-arrow">{{ macros_translate::translate(key="previous", default="Previous", language_strings=language_strings) }}</div>
|
||||||
|
<span class="post-title">{{ page.higher.title }}</span>
|
||||||
|
</a>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if page.lower -%}
|
||||||
|
<a class="post-nav-item post-nav-next" href="{{ page.lower.permalink }}">
|
||||||
|
<div class="nav-arrow">{{ macros_translate::translate(key="next", default="Next", language_strings=language_strings) }}</div>
|
||||||
|
<span class="post-title">{{ page.lower.title }}</span>
|
||||||
|
</a>
|
||||||
|
{%- endif -%}
|
||||||
|
</nav>
|
||||||
|
{%- endif -%}
|
||||||
|
{% endblock content %}
|
||||||
66
templates/subproject_list.html
Normal file
66
templates/subproject_list.html
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{%- set date_format = macros_translate::translate(key="date_format", default="%B %d, %Y", language_strings=language_strings) -%}
|
||||||
|
{%- set date_locale = macros_translate::translate(key="date_locale", default="en_US", language_strings=language_strings) -%}
|
||||||
|
|
||||||
|
{%- if paginator.pages -%}
|
||||||
|
{%- set number_of_posts = paginator.total_pages -%}
|
||||||
|
{%- elif section.pages -%}
|
||||||
|
{%- set number_of_posts = section.pages | length -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<h1>{{ section.title }}</h1>
|
||||||
|
|
||||||
|
{{ section.content | safe }}
|
||||||
|
|
||||||
|
{# <div class="sparkline">
|
||||||
|
{%- if paginator.pages -%}
|
||||||
|
{%- set pages = paginator.pages -%}
|
||||||
|
{%- elif section.pages -%}
|
||||||
|
{%- set pages = section.pages -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- set pages = term.pages -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- for month, pages in pages | group_by(attribute="month") -%}
|
||||||
|
{%- set posts_per_bar = pages | length -%}
|
||||||
|
{%- set bar_height = pages | length * 10 -%}
|
||||||
|
<div style="--bar-height: {{ bar_height ~ '%' }}" title="{{ macros_translate::translate(key='posts', number=posts_per_bar, default='$NUMBER posts in total', language_strings=language_strings) }}"></div>
|
||||||
|
{%- endfor -%}
|
||||||
|
</div> #}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<small>
|
||||||
|
{%- if config.taxonomies | length > 0 -%}
|
||||||
|
<a href="{{ get_url(path='tags', lang=lang) }}">
|
||||||
|
{{ macros_translate::translate(key="filter_by_tag", default="Filter by tag", language_strings=language_strings) }}
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
{%- endif %}
|
||||||
|
{{ macros_translate::translate(key="posts", number=number_of_posts, default="$NUMBER posts in total", language_strings=language_strings) }}
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% include "partials/subprojects.html" %}
|
||||||
|
|
||||||
|
{%- if paginator.pages -%}
|
||||||
|
<nav id="paginator">
|
||||||
|
{%- if paginator.previous -%}
|
||||||
|
<a id="paginator-previous" href="{{ paginator.previous }}">
|
||||||
|
<i class="icon"></i>
|
||||||
|
<div>{{ macros_translate::translate(key='previous', default='Previous', language_strings=language_strings) }}</div>
|
||||||
|
</a>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div></div>
|
||||||
|
|
||||||
|
{%- if paginator.next -%}
|
||||||
|
<a id="paginator-next" href="{{ paginator.next }}">
|
||||||
|
<div>{{ macros_translate::translate(key='next', default='Next', language_strings=language_strings) }}</div>
|
||||||
|
<i class="icon"></i>
|
||||||
|
</a>
|
||||||
|
{%- endif -%}
|
||||||
|
</nav>
|
||||||
|
{%- endif -%}
|
||||||
|
{% endblock content %}
|
||||||
Loading…
x
Reference in New Issue
Block a user