posts

Display one or more posts inside an .xml file.

<posts name="homepage_posts" format="posts_popular" source="frontpage" limit="10" section_url="entertainment" />

Variants

<posts_without_current />

It is used the same way as <posts>, but excludes the current post (on a post page). When using <posts_without_current> you must define the limit attribute (see below) with 1 more than you actually need.


Attributes

  • name - define the name of the section. Required for displaying unique posts using the <posts_without_current> tag.
  • format - defines the mustache template that will be used to render each post, relative to engine/mustache/roar/posts/ directory.Usage: create a new .html template file inside the above directory (ex: posts_most_read.html). Use <posts format="posts_most_read"> inside an .xml file to render this type of posts.
  • template - defines the mustache template that will be used to render each post, relative to engine/mustache/ directory.
  • source - post source used to fetch data from. (default is "frontpage"). It can take one of the following values:
    • frontpage - load posts for front page or any other subpage (section);
    • search_result - load posts that are result of some search;
    • tag - load posts for specified tag;
    • popular - load most popular (most read) posts for last 3 days;
    • related - load related posts (calculated by similar tags); if there's no related posts, then populate it with posts from the same section;
    • mentioned - load mentioned posts (if current post has any internal links, i.e. links to posts on the same domain, then this posts will be "mentioned" for current post).
  • limit - maximum number of posts to show in this block.
  • css_classes - add additional css classes for the posts wrapper.
  • section_url - name of the section used as source for posts.
    • If source="popular", you can specify more than one section separated by comma.
    • On article page you can use post's section as a base for displaying posts from the same section. Usage:
    • <posts_without_current format="posts-main" section_url="{{post.section}}" limit="4" />
  • no_posts_template - set a path to a jinja template that will be shown when no posts are found.
  • source_site - site used as source for posts. Use source_site="parent_site" on community pages so you can pull popular posts or posts from other sections with section_url="section-name".
  • section_template - define the template to be used for the posts wrapper (container). Default template located at: engine/community/roar/blocks/section.
  • source_unique - true OR false Posts among any source with this attribute are unique. For example if we have posts with ids [1,2,3] for frontpage source and posts with ids [3,4,5] for 'popular' source, 'popular' source excludes post 3 from its list and it becomes [4, 5].
  • tag_name - only relevant if source="tag". Name of the tag that will be used as source for posts (default to current tag on tag page).
  • exclude_section - way to omit posts (which are in certain section) when using popular source. Usage:
  • <posts format="popular-food" source="popular" exclude_section="fruits" />
  • filters - apply filters to posts. In order to minimize data transfer, your <posts> tag will not include all the data you may expect, such as author name or the section title this post belongs to. Use these filters to get more data about your post:
    • frontpage_tag - take the first tag from public_tags of the post and assign to 'frontpage_tag' key on the same post;
    • original_user_subsite - add author data to your post;
    • section - add section info on the post. If the post has multiple sections, the first not private section in the list will be returned. Usage:
    • <posts name="splash" format="splash_news" source="frontpage" filters="section" />
    • display_disclaimer - set the display_disclaimer attribute of the post to "True";
    • pretty_date - apply this function to this post. Usage:
    • <posts name="news2" format="news" source="frontpage" limit="4">  <filters>    <pretty_date field_name="created_ts" full_format="true" enable_future="false" date_format="%a, %d %b %Y %H:%M:%S +0000" new_field_name="created_ts_formatted"/>   </filters></posts>
      Now you should be able to use {{created_ts_formatted}} in your mustache template. Attributes of pretty_date:
      1. field_name required string - name of the field on the post for processing
      2. full_format optional boolean default - false.
      3. enable_future optional boolean default - false.
      4. date_format optional default - "%d %B %Y".
      5. new_field_name optional default - field_name. Name of the field on the post model where result of filter will be written. By default it will be written in the same field_name.
    • set_image_size - set the image_url context variable for desktop and/or mobile screen. Usage:
    • <posts name="popular" format="popular" source="popular" limit="1" section_url="popular">    <filters>        <set_image_size url="image528x304,image600x" mobile_url="imageWWWxHHH,image300x"  />    </filters></posts>

      You should now be able to include {{image_url}} in your mustache template

    • partial - override any partial used in your mustache template for post rendering. Example:

    • <posts name="news" format="news" source="frontpage" limit="6">    <partial name="roar/posts/partials/author/author" replace_with="custom/author"/></posts>

Applying filters

Set them in the filters attribute (if there are more than 1 filter to define, separate them with comma, no spaces allowed). Example:

<posts name="news" format="news" source="frontpage" limit="6" filters="frontpage_tag,display_disclaimer"/>

Set them in the <filters> child tag. Example:

<posts name="news" format="news" source="frontpage" limit="6">  <filters>    <frontpage_tag/>    <display_disclaimer/>  </filters></posts>

It is also acceptable to define filters both ways into a single <posts> tag. Example:

<posts name="news" format="news" source="frontpage" limit="6" filters="frontpage_tag">  <filters>    <display_disclaimer/>  </filters></posts>

Why RebelMouse Is the Best Content Marketing Platform

RebelMouse is a unique platform and company. The company was founded on the vision that media companies would need an always-modern solution to thrive in the new connected internet, and that brands would have to behave like new media companies and use the same platforms.

Keep reading... Show less

Why Premium Creative Agencies and CTOs Choose to Develop on RebelMouse vs. WordPress and Drupal

The Intersection of Design and Development: Where Your Clients Thrive

We started RebelMouse seven years ago knowing that there was a fundamental design flaw in the world of traditional CMSs: Every instance, on every platform, had to be updated independently. It's similar to an era when users had to manage their own Microsoft Exchange Server for email. The costs of managing, maintaining, and iterating on a CMS to keep it awesome and world class is typically a $10 million-a-year endeavor. But even then, these cost-prohibitive CMSs are still behind the times.

Keep reading... Show less

Native Multivariate Testing at Scale With RebelMouse

What Differentiates Our Approach

There are many popular tools that allow you to perform experiments and A/B tests on your users — primarily Google Chrome Experiments and Optimizely. But all of these solutions are JavaScript additions to your web page that sidestep the problem of old, outdated, and clumsy CMSs. These solutions work by calling on a third-party JavaScript library that rewrites a page after it's rendered. This approach adds extra page weight and creates strange user experiences due to having to wait for everything to load and be rewritten on the fly.

At RebelMouse, we've solved this in a very elegant way. At the core level of our platform, we can natively render different layouts and track the exact differences in performance when comparing a test to your other layouts.

Keep reading... Show less

Modern E-Commerce: Blur the Line Between Content and Design

Create Modular + Reusable Design Patterns on RebelMouse

Content saturation is an industry-wide problem, and the e-commerce space is no exception given that it's filled with big brands, small Etsy stores, and everyone in between all fighting for similar audiences. The best way to fight this symptom is to understand your audience and provide them with what they want.

Keep reading... Show less

Instagram-style E-commerce Features on RebelMouse

Revolutionizing E-commerce on RebelMouse

Whether you're a brand with a blog or a media company with a site, driving purchasing behavior and building an audience that uses your content to find things they love to buy is vital. We're very proud to have built out the same functionality that everyone is now used to on Instagram, with layovers on images that lead to products with attribution.

Keep reading... Show less

Building Premium Communities and User Journeys on RebelMouse

RebelMouse is much more than just a replacement for a traditional CMS. Our platform is a tremendous community-building experience. Today's social ecosystem has given us a seemingly limitless number of premium creators who understand how to create gorgeous and relevant content that drives the growth of their own audiences. These creators and influencers are either experts in certain topics, or heavily engaged in targeted content that drives their interests. They're not only consuming the content they're passionate about, but they're contributing to the conversation, too. The new role of the editor is not just to cover the most important topics and people around their expertise, but also to invite those preferred influencers into their community and get them to participate in creating premium content.

Keep reading... Show less

Dynamic Voting: Grow Traffic and Engagement Organically

Help your audience find its voice.

Creating quality content is no longer on marketers alone. We live in a universe of creators who are willing to not only consume content that resonates, but play a role in the creation, promotion, and conversations surrounding it.

Since the start of RebelMouse, we've been on a journey to create dynamic media that is easier for content creators to curate and amplify on social. It's why we've built an online engagement platform centered around the power of communities that thrive naturally in the digital ecosystem.

Keep reading... Show less

How to Monetize Your Website in Today’s Publishing Environment

In order to define distributive publishing, we have to ask the following question: If you have quality content, but nobody sees it, does it even exist? The answer is no, because your content needs to be supported in a way that lets it move seamlessly across all channels, especially site, search, and social. But let's take this question a step further: If you can't monetize your content to generate the support it needs, how do you create quality content in the first place?

Keep reading... Show less

How COVID-19 Has Changed Four Key Components of Marketing

Picking up the pieces and the importance of building trust in a pandemic

As the second half of 2020 begins to pass us by, the COVID-19 pandemic continues to rage on throughout the global community. The longevity of the pandemic has left thousands of industries struggling to find an appropriate position in the marketplace that will allow them to sustain themselves alongside daily tragedy.

The pandemic is far from over, but publishers and marketers are beginning to sift through the aftershocks of what COVID-19 has done to the web. Here's a quick look at the decline in conversion growth during the first few weeks of the pandemic in the United States:

Keep reading... Show less

Explore Careers at RebelMouse

Join RebelMouses's modern and distributive workforce responsible for the websites of media powerhouses, including legacy brands like United Airlines and new media darlings like PAPER Magazine and Protocol.

If you feel like you've never quite fit into boxes or labels within the tech space, we want to hear from you. Built on a foundation of site performance, our cloud-based platform reaches 50+ million people a month with an always-modern approach to product and strategy.

Our fully remote team spans 25+ countries and has very flexible schedules. If you don't want to be confined to an office chair, and like the idea of being able to work from any place in the world you choose, we're a match.

RebelMouse is dedicated to pursuing inclusion for all individuals, regardless of their gender identity, sexual preference, ethnicity, religion, age, or disability. We work hard to form meaningful relationships beyond our platform, and it's this passion that has formed what is now a diverse software company and creative agency that's bucking industry norms. For us, diversity is a company pillar, not just a statistic.

Click here to browse our current opportunities
Subscribe to Our Newsletter