{% extends 'pages/landingpage/default.twig' %} {% set options = options|default({}) + { landingpage_sections_field: 'text', portal_highlight: false, page_variant: 'taxonomy', sections_autowrapper_containerclass: 'container', sections_autowrapper_rowclass: 'row', sections_autowrapper_colclass_default: 'col-md-8', sections_autowrapper_adcolclass: 'col-md-4 text-center', taxonomy_pool: false, taxonomy_length: 12, taxonomy_params: [], taxonomy_teaserlist_label: '', taxonomy_teaser_imagesize: 'teaser_landscape', taxonomy_contenttype: taxonomy.singular_slug ~ 'page', } %} {# Required variables # record - the portal page itself otherwise a fake recored wil be created for the taxonomy # objects - array of content objects (records) to display in teaserlist (optional, can select it's own records via pool parameters) # teasers - array of teasers in addition converted objects above (optional, will use it's own records) #} {# --- Logic -------------------------------------------------------------------------------------------------------- #} {# Replace broken Bolt taxonomy logic with corrected data - NOTE: This requires the taxonomies module #} {% set taxonomy = Taxonomies.getTaxonomy(taxonomy.singular_slug, slug) %} {% set slug = taxonomy.selected_slug|default(slug) %} {# Search for replacement record for this taxonomy #} {% set contenttype = options.taxonomy_contenttype %} {% setcontent record = contenttype where {'slug': slug} returnsingle %} {# if no record found for taxonomy, create a fake record object #} {% if not record|default %} {% set record = app.storage.getContentObject(contenttype,{ 'title': taxonomy.selected_name|default(slug), 'status': 'published', (options.landingpage_sections_field): '', }) %} {% set res = record.setTaxonomy(taxonomy.slug, slug, taxonomy.selected_name|default(slug)) %} {% endif %} {# --- Templating --------------------------------------------------------------------------------------------------- #} {% block content %} {{ parent() }} {% block taxonomy_autolist %} {# load records for taxonomy page #} {# Logik needs to stay here as we need other teaserlists processed first to get their excludes in #} {# Also this call disabled adding items to shownItems since next page will have an offset for that #} {% if options.taxonomy_pool %} {% set objects = [] %} {% set items = RelationFill.getItems(options.taxonomy_pool, (options.taxonomy_length + 1), options.taxonomy_params + { (taxonomy.singular_slug): slug }, [], 'default', false) %} {% for item in items[:(options.taxonomy_length)] %} {% set objects = objects|merge([item.object]) %} {% endfor %} {% else %} {% set objects = records %} {% endif %} {# convert records to teasers #} {% set teasers = generateTeasers(objects, { teaserImageSize: options.taxonomy_teaser_imagesize }) %}
{% include [ "blocks/list/default.twig" ] with { teasers: teasers, options: options + { list_label: options.taxonomy_teaserlist_label, list_limit: options.taxonomy_length, list_excludes: RelationFill.getShownIds()|json_encode, list_loadmore_url: (items|length > options.taxonomy_length) ? url('designs:pagedsimple:view', {taxonomytype: taxonomy.singular_slug, slug: slug, page: 2}) : false, list_loadmore_url_ajax: url('designs:pagedsimple:view', {taxonomytype: taxonomy.singular_slug, slug: slug, page: 'PAGE'}), } } %}
{# add ad slot #}
{% include "components/ads/slot.twig" with { options: { slot_type: 'rail', slot_class: 'sticky-ad advertisement-rail', }} %}
{% endblock %} {% endblock %}