全てのHubLのコード
{% set pop_posts = blog_popular_posts('default', 5) %}<div class="popular"> <h2 class="popular-title">人気記事</h2> {% for pop_post in pop_posts %} <a href="{{pop_post.absolute_url}}" class="popular-articles"> {% if pop_post.post_list_summary_featured_image %} <img src="{{ pop_post.post_list_summary_featured_image }}" class="popular-articles-image" alt="{{ pop_post.featured_image_alt_text | escape }}"> {% endif %} <h3 class="popular-articles-title">{{ pop_post.name }}</h3> <p class="post-header-title-data">記事公開日: {{ pop_post.publish_date_local_time.strftime('%Y.%m.%d') }}</p> <p>{{ pop_post.post_body|truncate(31, True, '…' ) }}</p> </a> {% endfor %} {% if pop_post.topic_list %} <p id="popular-articles-topic"> トピック: {% for topic in pop_post.topic_list %} <a class="popular-articles-topic-link" href="{{ blog_tag_url(group.id, topic.slug) }}">{{ topic.name }}</a> {% endfor %} </p> {% endif %}</div>
HTML個別のHubLのコード
人気記事の取得方法
{% set pop_posts = blog_popular_posts('default', 5) %}{% for pop_post in pop_posts %} //中身{% endfor %}
HTMLタイトルの取得方法
<h3 class="popular-articles-title">{{ pop_post.name }}</h3>
HTML記事公開日の取得方法
<p class="post-header-title-data">記事公開日: {{ pop_post.publish_date_local_time.strftime('%Y.%m.%d') }}</p>
HTML記事URLの取得方法
<a href="{{pop_post.absolute_url}}" class="popular-articles"></a>
HTML本文の取得方法
{{ pop_post.post_body|truncate(31, True, '…' ) }}
HTMLサムネイルの取得方法
{% if pop_post.post_list_summary_featured_image %}<img src="{{ pop_post.post_list_summary_featured_image }}" class="popular-articles-image" alt="{{ pop_post.featured_image_alt_text | escape }}">{% endif %}
HTMLトピック(タグ)の取得方法
{% if pop_post.topic_list %}<p id="popular-articles-topic"> トピック: {% for topic in pop_post.topic_list %} <a class="popular-articles-topic-link" href="{{ blog_tag_url(group.id, topic.slug) }}">{{ topic.name }}</a> {% endfor %}</p>{% endif %}
HTML