Skip to main content

r:blog:{attr}

<r:blog:{attr} />

This is not truly a tag, but rather a format you would use to get properties about the blog post or index, where attr is replaced by the information you are retrieving.

Most of the attribute options available for <r:page:{attr} /> are also available for <r:blog:{attr} />. The attributes listed below are <r:blog:{attr} /> specific attributes:

Attribute Options

  • <r:blog:archive:monthly /> - Displays an unordered list of blog archives. Eg: December 2012, January 2013, June 2015.
    • date_format - How to output the date portion of the data. Uses the same syntax as <r:date_format> (Default: %B %Y)
    • include_count - Boolean. Whether or not to include a <span> with the number of articles for each item (Default: true)
    • ul_class - The class applied to the <ul>.
    • count_class - The class applied to the <span> containing the article count.

Example

<r:blog:archive:monthly />

Or:

<r:blog:archive:monthly date_format="%b %Y" include_count="true" ul_class="blog-archive" count_class="blog-archive__count"/>

blog.{attr}

This is not truly a tag, but rather a format you would use to get properties about the blog post or index, where attr is replaced by the information you are retrieving. For some "real world" uses of blog.{attr}, see our page on Blog Templates.

blog.{attr} must be used on a Blog Index or Blog Article page type. Or, it must be used in a loop inside of the blog context (likely via get_page).

Most of the attribute options available for page.{attr} are also available for blog.{attr} . The attributes listed below are blog.{attr} specific attributes:

Attribute options

articles - Refers to the articles drop. See our documentation for article.{attr} for more information.

months_archive - Parent tag used to build an monthly blog archive. Returns an array. When used in a loop, the first item in the array (at position 0) reutrns the year and month (eg: 2021/1). The second item in the array (position 1) returns how many blog posts were made in that month.

Examples

Just like page.{attr}, you can use many of the same attributes for blog.{attr}:

{{ blog.id }} <!-- 1234 -->
{{ blog.name }} <!-- Blog -->
{{ blog.slug }} <!-- blog -->
{{ blog.author.full_name }} <!-- May Day -->
<!-- ...and many more... -->

A blog archive:

<h3>Archives</h3>
{% if blog.months_archive.size > 0 %}
  <ul class="wvu-blog-archive">
    {% for entry in blog.months_archive %}
      <li>
        <a class="wvu-blog-archive__month-year" href="{{ blog.url | append: '/' | append: entry[0] }}">
          {{- entry[0] | date: "%B %Y" -}}
        </a>
        <span class="wvu-blog-archive__posts-in-month">({{ entry[1] }})</span>
      </li>
    {% endfor %}
  </ul>
{% endif %}

In the example above, {{ entry[0] }} returns 2021/1 and {{ entry[1] }} returns n where n is the number of blog posts for that month.

Last updated on March 15, 2021.

We welcome all questions, feedback and bug reports. If you're having an issue, we usually need the following information:

  • A brief description of the issue
  • A link to the page where you saw the issue
  • Screenshots that illustrate the problem - How do I take a screenshot?

Kindly email CleanSlate@mail.wvu.edu for help or use the form on the request help page.