Lista tagów handlebars do paragrafu modułu Artykuły
Utworzono:
2022-04-06
Ostatnia aktualizacja: 2025-04-25
Ostatnia aktualizacja: 2025-04-25
Liczba odwiedzin posta: 2198
Przykłady użycia Handlebars w module Artykuły
✅ Wyświetlenie tytułu i treści artykułu
<h1>{{title}}</h1>
<div class="article-content">
{{{content}}}
</div>
✅ Warunkowe wyświetlenie obrazka głównego (jeśli istnieje)
{{#if has_image}}
<img src="{{image_large_url}}" alt="{{image_alt_text}}" />
{{/if}}
✅ Jeśli nie ma obrazka, wstawiamy obrazek domyślny
{{#if has_image}}
<img src="{{image_large_url}}" alt="{{image_alt_text}}" />
{{else}}
<img src="https://example.com/img/domyslny.jpg" alt="Obrazek domyślny" />
{{/if}}
✅ Warunkowe wyświetlenie autora i daty publikacji
<p>
Opublikowano: {{publish_from_day}}
{{#if author_name}} przez {{author_name}}{{/if}}
</p>
✅ Wyświetlenie tagów (jeśli są)
{{#if show_tags}}
<p>Tagi:
{{#each tags}}
<span class="tag">{{name}}</span>
{{/each}}
</p>
{{/if}}
✅ Sprawdzenie konkretnej kategorii (np. czy artykuł NIE należy do bloga Sugester)
{{#each categories}}
{{#not_eq name "blog Sugester"}}
<span class="category">{{name}}</span>
{{/not_eq}}
{{/each}}
✅ Wyświetlenie obrazka w zależności od source_name
{{#if source_name}}
{{#eq source_name "pole-source"}}
<img src="https://fs.siteor.com/artykuly-test/files/img/obr1.png" alt="Obrazek 1" />
{{else}}
{{#eq source_name "pole-source2"}}
<img src="https://fs.siteor.com/artykuly-test/files/img/obr2.png" alt="Obrazek 2" />
{{else}}
{{#eq source_name "pole-source3"}}
<img src="https://fs.siteor.com/artykuly-test/files/img/obr3.png" alt="Obrazek 3" />
{{else}}
<img src="{{source_name}}" alt="Obrazek z source_name" />
{{/eq}}
{{/eq}}
{{/eq}}
{{/if}}
✅ Wyświetlenie powiązanych artykułów
{{#if show_linked_articles}}
<h3>Zobacz też:</h3>
<ul>
{{#each linked_articles}}
<li><a href="{{url}}">{{title}}</a></li>
{{/each}}
</ul>
{{/if}}
✅ Warunkowe wyświetlenie video (jeśli dodano)
{{#if video_url}}
<div class="video">
<iframe width="560" height="315" src="{{video_url}}" frameborder="0" allowfullscreen></iframe>
</div>
{{/if}}
Pełna Lista tagów do użycia:id -
{{id}}
canonical_url -
{{canonical_url}}
title -
{{title}}
parsed_title -
{{parsed_title}}
enable_wcag21 -
{{enable_wcag21}}
author -
{{author}}
author_name -
{{author_name}}
author_email -
{{author_email}}
author_img -
{{author_img}}
abstract -
{{abstract}}
content -
{{content}}
author_url -
{{author_url}}
publisher_url -
{{publisher_url}}
publisher -
{{publisher}}
publish_from -
{{publish_from}}
publish_from_day -
{{publish_from_day}}
publish_from_long -
{{publish_from_long}}
publish_from_date_long -
{{publish_from_date_long}}
publish_to -
{{publish_to}}
created_at -
{{created_at}}
updated_at -
{{updated_at}}
generated_at -
{{generated_at}}
updated_by -
{{updated_by}}
print_url -
{{print_url}}
show_path -
{{show_path}}
show_url -
{{show_url}}
has_image -
{{has_image}}
image_url -
{{image_url}}
image_large_url -
{{image_large_url}}
image_big_url -
{{image_big_url}}
image_medium_url -
{{image_medium_url}}
image_mini_url -
{{image_mini_url}}
image_enlarge -
{{image_enlarge}}
show_image_detail -
{{show_image_detail}}
image_description -
{{image_description}}
image_alt_text -
{{image_alt_text}}
has_content -
{{has_content}}
categories -
{{categories}}
attachments -
{{attachments}}
show_attachments -
{{show_attachments}}
comments_count -
{{comments_count}}
images -
{{images}}
gallery_images -
{{gallery_images}}
show_gallery -
{{show_gallery}}
gallery_url -
{{gallery_url}}
show_images -
{{show_images}}
linked_articles -
{{linked_articles}}
show_linked_articles -
{{show_linked_articles}}
show_tags -
{{show_tags}}
tags -
{{tags}}
source_name -
{{source_name}}
source_url -
{{source_url}}
first_last -
{{first_last}}
pages_count -
{{pages_count}}
pages_content -
{{pages_content}}
current_page_no -
{{current_page_no}}
next_page_url -
{{next_page_url}}
prev_page_url -
{{prev_page_url}}
page_no -
{{page_no}}
video_url -
{{video_url}}
video_key -
{{video_key}}
Powrót
Dodaj komentarz