fix: rename tag template variable to hashtag to avoid Nunjucks macro collision

The base layout default.njk imports a `tag` component macro which shadows
the controller's `tag` variable in function/filter argument contexts.
Renaming to `hashtag` eliminates the collision entirely.
This commit is contained in:
Ricardo
2026-02-27 14:05:44 +01:00
parent 41bde656e4
commit cfc5af8092
3 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ export function tagTimelineController(mountPath) {
response.render("activitypub-tag-timeline", { response.render("activitypub-tag-timeline", {
title: `#${tag}`, title: `#${tag}`,
readerParent: { href: `${mountPath}/admin/reader`, text: response.locals.__("activitypub.reader.title") }, readerParent: { href: `${mountPath}/admin/reader`, text: response.locals.__("activitypub.reader.title") },
tag, hashtag: tag,
items, items,
before: result.before, before: result.before,
after: result.after, after: result.after,
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@rmdes/indiekit-endpoint-activitypub", "name": "@rmdes/indiekit-endpoint-activitypub",
"version": "2.0.34", "version": "2.0.35",
"description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
"keywords": [ "keywords": [
"indiekit", "indiekit",
+8 -8
View File
@@ -4,7 +4,7 @@
{# Tag header #} {# Tag header #}
<header class="ap-tag-header"> <header class="ap-tag-header">
<div class="ap-tag-header__info"> <div class="ap-tag-header__info">
<h2 class="ap-tag-header__title">#{{ tag }}</h2> <h2 class="ap-tag-header__title">#{{ hashtag }}</h2>
<p class="ap-tag-header__count"> <p class="ap-tag-header__count">
{{ __("activitypub.reader.tagTimeline.postsTagged", items.length) }} {{ __("activitypub.reader.tagTimeline.postsTagged", items.length) }}
</p> </p>
@@ -13,7 +13,7 @@
{% if isFollowed %} {% if isFollowed %}
<form action="{{ mountPath }}/admin/reader/unfollow-tag" method="post" class="ap-tag-header__follow-form"> <form action="{{ mountPath }}/admin/reader/unfollow-tag" method="post" class="ap-tag-header__follow-form">
<input type="hidden" name="_csrf" value="{{ csrfToken }}"> <input type="hidden" name="_csrf" value="{{ csrfToken }}">
<input type="hidden" name="tag" value="{{ tag }}"> <input type="hidden" name="tag" value="{{ hashtag }}">
<button type="submit" class="ap-tag-header__unfollow-btn"> <button type="submit" class="ap-tag-header__unfollow-btn">
{{ __("activitypub.reader.tagTimeline.unfollowTag") }} {{ __("activitypub.reader.tagTimeline.unfollowTag") }}
</button> </button>
@@ -21,7 +21,7 @@
{% else %} {% else %}
<form action="{{ mountPath }}/admin/reader/follow-tag" method="post" class="ap-tag-header__follow-form"> <form action="{{ mountPath }}/admin/reader/follow-tag" method="post" class="ap-tag-header__follow-form">
<input type="hidden" name="_csrf" value="{{ csrfToken }}"> <input type="hidden" name="_csrf" value="{{ csrfToken }}">
<input type="hidden" name="tag" value="{{ tag }}"> <input type="hidden" name="tag" value="{{ hashtag }}">
<button type="submit" class="ap-tag-header__follow-btn"> <button type="submit" class="ap-tag-header__follow-btn">
{{ __("activitypub.reader.tagTimeline.followTag") }} {{ __("activitypub.reader.tagTimeline.followTag") }}
</button> </button>
@@ -37,7 +37,7 @@
{% if items.length > 0 %} {% if items.length > 0 %}
<div class="ap-timeline" <div class="ap-timeline"
data-mount-path="{{ mountPath }}" data-mount-path="{{ mountPath }}"
data-tag="{{ tag }}" data-tag="{{ hashtag }}"
data-before="{{ before if before else '' }}"> data-before="{{ before if before else '' }}">
{% for item in items %} {% for item in items %}
{% include "partials/ap-item-card.njk" %} {% include "partials/ap-item-card.njk" %}
@@ -48,12 +48,12 @@
{% if before or after %} {% if before or after %}
<nav class="ap-pagination ap-pagination--js-hidden" id="ap-tag-pagination"> <nav class="ap-pagination ap-pagination--js-hidden" id="ap-tag-pagination">
{% if after %} {% if after %}
<a href="?tag={{ tag }}&after={{ after }}" class="ap-pagination__prev"> <a href="?tag={{ hashtag }}&after={{ after }}" class="ap-pagination__prev">
{{ __("activitypub.reader.pagination.newer") }} {{ __("activitypub.reader.pagination.newer") }}
</a> </a>
{% endif %} {% endif %}
{% if before %} {% if before %}
<a href="?tag={{ tag }}&before={{ before }}" class="ap-pagination__next"> <a href="?tag={{ hashtag }}&before={{ before }}" class="ap-pagination__next">
{{ __("activitypub.reader.pagination.older") }} {{ __("activitypub.reader.pagination.older") }}
</a> </a>
{% endif %} {% endif %}
@@ -66,7 +66,7 @@
id="ap-load-more" id="ap-load-more"
data-before="{{ before }}" data-before="{{ before }}"
data-tab="" data-tab=""
data-tag="{{ tag }}" data-tag="{{ hashtag }}"
x-data="apInfiniteScroll()" x-data="apInfiniteScroll()"
x-init="init()" x-init="init()"
@ap-append-items.window="appendItems($event.detail)"> @ap-append-items.window="appendItems($event.detail)">
@@ -79,6 +79,6 @@
</div> </div>
{% endif %} {% endif %}
{% else %} {% else %}
{{ prose({ text: __("activitypub.reader.tagTimeline.noPosts") | replace("%s", tag) }) }} {{ prose({ text: __("activitypub.reader.tagTimeline.noPosts", hashtag) }) }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}