diff --git a/public/theme/skeleton/listing.twig b/public/theme/skeleton/listing.twig index ddd1ec678..1ef820e4b 100644 --- a/public/theme/skeleton/listing.twig +++ b/public/theme/skeleton/listing.twig @@ -8,22 +8,11 @@ are on this page. It can be used for overview pages like 'all entries', or 'all records tagged with kittens'. #} - {# If used for listing a taxonomy, we add a heading.: #} - {% if taxonomy|default %} + {# If used for listing a taxonomy, we add a heading #} + {% if taxonomy is defined %}

- {{ __('general.phrase.overview-for') }} - {% if taxonomy.options[slug] is defined %} - {{ taxonomy.options[slug] }} - {% else %} - {{ slug }} - {% endif %} + {{ __('general.phrase.overview-for', {'%slug%': taxonomy.options[slug]|default(slug) }) }}

- {# Taxonomies are fetched unordered by design except if 'has_sortorder' - is set to true. This way we keep 'grouping' intact in the listing. #} - {% if not taxonomy.has_sortorder %} - {# If we specified an order in config.yml, sort them here, accordingly: #} - {% set records = records|order(config.get('general/listing_sort')) %} - {% endif %} {% endif %} {% for record in records %} diff --git a/src/Controller/Frontend/TaxonomyController.php b/src/Controller/Frontend/TaxonomyController.php index aadfaa0da..d1115aed4 100644 --- a/src/Controller/Frontend/TaxonomyController.php +++ b/src/Controller/Frontend/TaxonomyController.php @@ -35,11 +35,19 @@ public function listing(ContentRepository $contentRepository, Request $request, $page = (int) $request->query->get('page', 1); $amountPerPage = $this->config->get('general/listing_records'); + $taxonomy = $this->config->get('taxonomies/'. $taxonomyslug); + /** @var Content[] $records */ $records = $contentRepository->findForTaxonomy($page, $taxonomyslug, $slug, $amountPerPage); $templates = $this->templateChooser->forTaxonomy($taxonomyslug); - return $this->renderTemplate($templates, ['records' => $records]); + $twigVars = [ + 'records' => $records, + 'taxonomy' => $taxonomy, + 'slug' => $slug, + ]; + + return $this->renderTemplate($templates, $twigVars); } } diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 2788d0cd8..28397cfc0 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -1821,5 +1821,23 @@ Predominant colors in image + + + general.phrase.overview-for + Overview for '%slug%' + + + + + general.phrase.related-content + Related content + + + + + action.search + Search + +