Replies: 3 comments 5 replies
-
|
I’m not entirely sure about your specific use case, but it seems like a Relation Field might be what you’re looking for. In my case, I use it to handle “Related Articles,” allowing me to link or reference specific pieces of content that are connected to a particular page topic. Here’s an example of how the CMS configuration and the Tera templating code could be set up: - name: extra
label: Related Articles
widget: object
i18n: true
fields:
- name: related
label: Related
widget: relation
collection: posts
value_field: '{{slug}}'
display_fields: [title]
search_fields: [title]
multiple: true
max: 4
required: false
i18n: true {% if page.extra.related %}
{% set related_articles = page.extra.related %}
<section class="gh-container is-grid gh-outer">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">Read more</h2>
<div class="gh-feed">
{% for next in related_articles[:5] %}
{% set post = get_page(path="posts/" ~ next ~ "/index.md", lang=lang) %}
{{<post_card post lazyLoad={true}/>}}
{% if loop.index is divisible_by(divisor=1) and not loop.last %}
{% include "partials/ads-feed-post.html" %}
{% endif %}
{% endfor %}
</div>
</div>
</section>
{% endif %}For the Markdown content, it looks like this: +++
title = "tes"
[extra]
related = ["post-1-tes", "post-2-tes"]
+++I’m using Zola with the unreleased Tera 2 version. |
Beta Was this translation helpful? Give feedback.
-
|
Aliases mean redirects, right? From the doc: # Use aliases if you are moving content but want to redirect previous URLs to the
# current one. This takes an array of paths, not URLs.
aliases = []I don’t think it’s supposed to be generated automatically for every single entry. It’s not a feature for creating short URLs. |
Beta Was this translation helpful? Give feedback.
-
|
There might be a practical/reasonable use case for aliases support. When an entry slug is edited, the CMS could add the old path to the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there, I am at process setting up sveltia.
The only thing I'm lacking right now is somehow getting automatically
created aliases entries.
For example, when I post something like
cool-blog-post.md, I use Kate snippetsto generate an alias like this:
aliases = ["/2026/04/21/2026-04-21-cool-blog-post.md.html"]Is there any way to do this? I could not get string transformations work inside a field, maybe I'm doing something wrong.
So in summary, blogpost called
Cool Blog Poston date2026-04-21should get an alias field like:aliases = ["/2026/04/21/2026-04-21-cool-blog-post.md.html"]Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions