Repository navigation
Tags documentation very light #2485
Replies: 8 comments
|
Any comments or help with this one? |
|
Hello @jannekalliola, I think there's some confusion between the concept of taxonomy and the term "category." In your example, you created a dedicated term called "series" but you seem to be using it as if it were the term "category." Also, if you want to group blog posts by series, you need to:
series: ["Data Sovereignty"]
https://cecil.app/documentation/templates/#type-vocabulary For example, on my personal blog, I created a "years" vocabulary to group my posts by year:
Does that make things clearer? |
|
Hello, I was maybe a bit too quick for me own good when I wrote the issue. I have configured three set of taxonomies: taxonomies:
tags: tag
categories: category
series: serieThen in a blog post, I'm using two of those in the front matter. categories: ["Data Sovereignty"]
series: ["Understanding European Data Sovereignty"]And in layouts/blog/page.twig.html I have the following (and this works ok): {% if page.categories is defined %}
<p>Categories:
{% for cat in page.categories %}
<strong><a href="{{ url('categories/' ~ cat) }}">{{cat}}</a></strong>{{ not loop.last ? ',' }}
{% endfor %}
</p>
{% endif %}
{% if page.series is defined %}
<p>Blog post series:
{% for ser in page.series %}
<strong><a href="{{ url('series/' ~ ser) }}">{{ser}}</a></strong>{{ not loop.last ? ',' }}
{% endfor %}
</p>
{% endif %}This results the following HTML: <p>
Categories:<strong><a href="/categories/Data Sovereignty">Data Sovereignty</a></strong>
</p>
<p>
Blog post series:<strong><a href="/series/Understanding European Data Sovereignty">Understanding European Data Sovereignty</a></strong>
</p>The first note is that url() function does not slugify the taxonomies or change spaces into %20. The problem lies in making a listing page for the categories (I haven't yet even tried with series, as categories failed). The file is in layouts/taxonomy/categories.html.twig (I don't know whether this is the right place or not) {% set pages = site.pages.showable %}
{% if page.pages is defined %}
{%- set pages = page.pages -%}
{% endif %}
{% if page.paginator.pages is defined %}
{%- set pages = page.paginator.pages -%}
{% endif %}
{% include 'partials/header.html.twig' %}
<main>
<section id="blog">
<h1>Coonti Tags</h1>
<article>
{%- for p in pages ~%}
<div class="bloglistitem">
{% if p.image is defined %}<div class="bloglistimage"><a href="{{ url(p) }}" class="noline"><img src="{{ url(asset('images/' ~ p.image)) }}" alt=""></a></div>{% endif %}
<div class="bloglisttext">
<h2><a href="{{ url(p) }}">{{ p.title|e }}</a></h2>
{% if p.categories is defined %}<p><strong>{{ p.categories|join(', ') }}</strong></p>{% endif %}
{% if p.excerpt is defined %}<p><strong>{{ p.date|date('F j, Y') }}</strong> – {{p.excerpt}}{% endif %}</p>
</div>
</div>
{%- endfor ~%}
</article>
</section>
</main>
{% include 'partials/footer.html.twig' %}Cecil does not generate any listing pages. What am I doing wrong? I didn't find any answers from the documentation, hence opening this issue on the first place. |
|
Hello @jannekalliola, I'm not able to reproduce teh case of not suglified links to categories from... it's like page of each categories was not correctly generated. |
|
Invite sent. Kindly send me a mail to janne@kallio.la should you have any issues. |
|
Hello. Any progress with the tag / categories issue? |
|
Hello @jannekalliola, Thanks for your patience, and sorry for the slow reply. Your report helped us find several problems, in the documentation and in Cecil itself. What went wrongThe vocabulary and its terms use different templates:
Your How to fix your site1. List of terms: {% include 'partials/header.html.twig' %}
<main>
<section id="blog">
<h1>{{ page.title }}</h1>
<ul>
{% for term in page.terms %}
<li><a href="{{ url(term.id) }}">{{ term.name }}</a> ({{ term|length }})</li>
{% endfor %}
</ul>
</section>
</main>
{% include 'partials/footer.html.twig' %}2. List of pages for a term: new file {% set pages = page.paginator.pages ?? page.pages %}
{% include 'partials/header.html.twig' %}
<main>
<section id="blog">
<h1>{{ page.title }}</h1>
<article>
{%- for p in pages ~%}
<div class="bloglistitem">
{% if p.image is defined %}<div class="bloglistimage"><a href="{{ url(p) }}" class="noline"><img src="{{ url(asset('images/' ~ p.image)) }}" alt=""></a></div>{% endif %}
<div class="bloglisttext">
<h2><a href="{{ url(p) }}">{{ p.title|e }}</a></h2>
{% if p.categories is defined %}<p><strong>{{ p.categories|join(', ') }}</strong></p>{% endif %}
{% if p.excerpt is defined %}<p><strong>{{ p.date|date('F j, Y') }}</strong> – {{ p.excerpt }}</p>{% endif %}
</div>
</div>
{%- endfor ~%}
</article>
<p><a href="{{ url(page.plural) }}">All {{ page.plural }}</a></p>
</section>
</main>
{% include 'partials/footer.html.twig' %}Do the same for series: If you need a specific template for one term only, create About links to termsYour links are fine: When you got {{ include('partials/terms-list.html.twig', {vocabulary: 'categories'}) }}What changed in Cecil
These changes will ship in the next release. Could you try the template names above and tell us if the term pages show up? If |
|
Hello and thank you for a great set of instructions. I got it working and was able to build and style the new pages as needed, too. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I have the following configuration:
I have template for categories in layouts/taxonomy/categories.html.twig.
Then I have in a blog post defined the following:
And in template I create links to the category as follows:
{% if page.series is defined %} <p>Blog post series: {% for ser in page.series %} <strong><a href="{{ url('series/' ~ ser) }}">{{ser}}</a></strong>{{ not loop.last ? ',' }} {% endfor %} {% endif %}This creates a link http://localhost:8000/categories/data-sovereignty/ that does not execute the aforementioned template, but a generic page template. If I use link http://localhost:8000/categories/, it uses the category template, but I have no clue what data does it have an access to.
I've read the documentation several times and found these settings from there, but I cannot get categories to work properly.
It would be awesome to get some guidance to move forward and expand the documentation to make using taxonomies easier.
To reproduce
No response
Expected behavior
I would like to see the pages in the given category listed.
Version
8.88.0
Operating System
No response
Relevant log output
All reactions