--- title: Cards Tester tagline: deck of posts description: responsive deck tags: [ Cards, Tester ] index: [ deck, post ] categories: [ pages ] toc: true advertising: false permalink: /pages/public/test_pages/deck_of_posts/ regenerate: false resources: [ lightbox, rtable ] resource_options: --- // Page Initializer // ============================================================================= // Enable the Liquid Preprocessor :page-liquid: // Set page (local) attributes here // ----------------------------------------------------------------------------- // :page--attr: // Load Liquid procedures // ----------------------------------------------------------------------------- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%} // Load page attributes // ----------------------------------------------------------------------------- {% include {{load_attributes}} scope="all" %} // Page content // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ == Deck of posts Bootstrap `card decks` are *not* responsive by default. Additional breakpoint classes for J1 Template introduce support on card decks for responsiveness. With the values for `break_on_XX`, the number of cards can be specified to be shown on a deck per *row*. .Read more . link:{url-stackoverflow--card_deck}[Stackoverflow {char-middot} Deck of Cards, {browser-window--new}] . link:{url-codeply--card_deck}[Codeply {char-middot} Deck of Cards, {browser-window--new}] ++++ {% comment %} Set config files -------------------------------------------------------------------------------- {% endcomment %} {% assign template_config = site.data.j1_config %} {% assign bs_config = template_config.bootstrap %} {% comment %} Set config data -------------------------------------------------------------------------------- {% endcomment %} {% assign bs_card_deck = bs_config.cards.card_deck %} {% assign posts_max = 6 %} {% assign post_category = 'featured' %} {% assign readmore_text = 'read' %} {% assign total_categoray_posts = 0 %} {% for cat in site.categories %} {% if cat[0] == post_category %} {% assign total_category_posts = cat[1].size %} {% endif %} {% endfor %} {% assign debug = true %} {% if debug %}

Total posts per category

{% endif %}

Posts per category {{post_category}}

Total posts in {{post_category}}: {{ total_category_posts }}
Max posts written: {{ posts_max }}

Settings for break_on_XX

{% for post in site.posts %} {% for category in post.categories %} {% if posts_written == posts_max %} {% assign last_post_written = true %} {% break %}{% endif %} {% if category == post_category and last_post_written != true %} {% assign posts_written = posts_written|plus:1 %}
{% if post.image %} {{post.title}} {% assign post_width = '80x' %} {% else %} {% assign post_width = '100x' %} {% endif %}

{{post.title}}

{{post.excerpt|truncatewords:50|replace:'...',' ...'|remove:'
'|remove:'
'|remove:'

'|remove:'

'}}
{% assign sm = posts_written | modulo: bs_card_deck.break_on_sm %} {% assign md = posts_written | modulo: bs_card_deck.break_on_md %} {% assign lg = posts_written | modulo: bs_card_deck.break_on_lg %} {% assign xl = posts_written | modulo: bs_card_deck.break_on_xl %} {% if sm == 0 %}
{% endif %} {% if md == 0 %}
{% endif %} {% if lg == 0 %}
{% endif %} {% if xl == 0 %}
{% endif %} {% endif %} {% endfor %} {% endfor %}
++++