From d30fd2b007a39ea5a8051a1203f8321f0f0de3a0 Mon Sep 17 00:00:00 2001 From: david-swift Date: Sat, 8 Mar 2025 11:56:33 +0100 Subject: [PATCH] Add subproject templates #2 --- config.toml | 2 + content/subprojects/_index.md | 7 ++ content/subprojects/blog/index.md | 10 ++ content/subprojects/docs/index.md | 10 ++ content/subprojects/subproject/index.md | 12 ++ templates/partials/subprojects.html | 67 ++++++++++ templates/subproject.html | 158 ++++++++++++++++++++++++ templates/subproject_list.html | 66 ++++++++++ 8 files changed, 332 insertions(+) create mode 100644 content/subprojects/_index.md create mode 100644 content/subprojects/blog/index.md create mode 100644 content/subprojects/docs/index.md create mode 100644 content/subprojects/subproject/index.md create mode 100644 templates/partials/subprojects.html create mode 100644 templates/subproject.html create mode 100644 templates/subproject_list.html diff --git a/config.toml b/config.toml index 855c1ba..8cc24de 100644 --- a/config.toml +++ b/config.toml @@ -131,6 +131,7 @@ show_repo = true # See https://www.getzola.org/documentation/content/linking/#internal-links links = [ { url = "@/blog/_index.md", name = "Blog" }, + { url = "@/subprojects/_index.md", name = "Subprojects" }, { url = "@/demo/index.md", name = "Demo" }, { url = "https://mastodon.de/@david_swift", name = "Developer" } ] @@ -140,6 +141,7 @@ links = [ # Same as the nav ones. links = [ { url = "@/blog/_index.md", name = "Blog" }, + { url = "@/subprojects/_index.md", name = "Subprojects" }, { url = "@/demo/index.md", name = "Demo" }, { url = "https://mastodon.de/@david_swift", name = "Developer" } ] diff --git a/content/subprojects/_index.md b/content/subprojects/_index.md new file mode 100644 index 0000000..00cd077 --- /dev/null +++ b/content/subprojects/_index.md @@ -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! diff --git a/content/subprojects/blog/index.md b/content/subprojects/blog/index.md new file mode 100644 index 0000000..ec5fd24 --- /dev/null +++ b/content/subprojects/blog/index.md @@ -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! diff --git a/content/subprojects/docs/index.md b/content/subprojects/docs/index.md new file mode 100644 index 0000000..6f23aca --- /dev/null +++ b/content/subprojects/docs/index.md @@ -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! diff --git a/content/subprojects/subproject/index.md b/content/subprojects/subproject/index.md new file mode 100644 index 0000000..868cc13 --- /dev/null +++ b/content/subprojects/subproject/index.md @@ -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. diff --git a/templates/partials/subprojects.html b/templates/partials/subprojects.html new file mode 100644 index 0000000..92180b4 --- /dev/null +++ b/templates/partials/subprojects.html @@ -0,0 +1,67 @@ +{%- if paginator.pages -%} + {%- set pages = paginator.pages -%} +{%- elif section.pages -%} + {%- set pages = section.pages -%} +{%- else -%} + {%- set pages = term.pages -%} +{%- endif -%} + +
+ {%- 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 -%} +
+ + {% if article_type %} + + + {{- article_string -}} + + {%- endif %} +

{{ page.title }}

+ {%- if page.description %} + {{ page.description | markdown | safe }} + {%- endif %} + {%- if page.date -%} +
+ + + {%- if page.authors -%} + {{ config.extra.separator | default(value="•") }} {% include "partials/authors.html" -%} + {%- endif -%} + + {%- if page.taxonomies -%} + {%- for name, taxon in page.taxonomies %} + +
    + {%-for item in taxon -%} +
  • {{ item }}
  • + {%- endfor %} +
+
+ {%- endfor -%} + {%- endif %} +
+ {%- endif -%} +
+ {%- endfor %} +
diff --git a/templates/subproject.html b/templates/subproject.html new file mode 100644 index 0000000..fb51e12 --- /dev/null +++ b/templates/subproject.html @@ -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 -%} + +
+ {%- if page.extra.banner -%} + + {%- endif -%} + +
+ {%- if page.date -%} +

+ + + {%- if page.updated -%} + {{ config.extra.separator | default(value="•") }} + + {%- endif -%} + +

+ {%- endif -%} + +

{{ page.title }}

+ + {%- if page.authors or config.extra.show_reading_time -%} +

+ + {%- if page.authors -%} + {% include "partials/authors.html" -%} + {%- if config.extra.show_reading_time -%} + {{ config.extra.separator | default(value="•") }} + {%- endif -%} + {%- endif -%} + + {%- if config.extra.show_reading_time -%} + {{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }} + {%- if page.taxonomies -%} + {{ config.extra.separator | default(value="•") }} + {%- endif -%} + {%- endif -%} + +

+ {%- endif -%} + + {%- if page.taxonomies -%} + {%- for name, taxon in page.taxonomies %} +
    + {%-for item in taxon -%} +
  • {{ item }}
  • + {%- endfor %} +
+ {%- endfor -%} + {%- endif %} +
+ +
+ {%- if page.extra.toc and page.toc | length > 0 -%} +
+ +
+ {{ macros_translate::translate(key="table_of_contents", default="Table of Contents", language_strings=language_strings) }} +
+ <{{ list_element }}> + {%- for h1 in page.toc -%} +
  • + {{ h1.title }} + {%- if h1.children -%} + <{{ list_element }}> + {%- for h2 in h1.children -%} +
  • + {{ h2.title }} +
  • + {%- endfor -%} + + {%- endif -%} + + {%- endfor -%} + +
    +
    +
    + {%- endif -%} + {%- if config.extra.show_backlinks and page.backlinks | length > 0 -%} + + {%- endif -%} + + {%- if config.extra.show_share_button -%} + + {%- endif -%} + {%- if config.extra.issues_url -%} + + {%- endif -%} +
    + + {%- 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 }} +
    + +{%- if page.extra.comments.id -%} + {%- include "partials/comments.html" -%} +{%- endif -%} + +{%- if page.lower or page.higher -%} +
    + +{%- endif -%} +{% endblock content %} diff --git a/templates/subproject_list.html b/templates/subproject_list.html new file mode 100644 index 0000000..c88fc73 --- /dev/null +++ b/templates/subproject_list.html @@ -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 -%} + +

    {{ section.title }}

    + +{{ section.content | safe }} + +{#
    + {%- 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 -%} +
    + {%- endfor -%} +
    #} + +

    + + {%- if config.taxonomies | length > 0 -%} + + {{ macros_translate::translate(key="filter_by_tag", default="Filter by tag", language_strings=language_strings) }} + +
    + {%- endif %} + {{ macros_translate::translate(key="posts", number=number_of_posts, default="$NUMBER posts in total", language_strings=language_strings) }} +
    +

    + +{% include "partials/subprojects.html" %} + +{%- if paginator.pages -%} + +{%- endif -%} +{% endblock content %}