Posts

General Usage

Example

<posts
    source="current_page"
    source_id="some-common-source-id"
    source_site="parent_site"
    source_unique="true"
    without_current="true"
    without_posts="123123,3123123,5325235"
    limit="20"
/>

Attributes

  • source (default: frontpage)
  • source_id (default: none) – allows combining several <posts /> elements into a single DB call
    • Usually generated automatically based on the other attributes
  • source_site (default: current_site) – sets up the context
    • current_site
      • author/community – for profile pages and community posts pages
      • runner/roar – for other pages
    • parent_site - runner/roar – for all pages
  • source_unique (default: false) – allows managing duplicates
  • without_current (default: false) – allows managing current post exclusion
  • without_posts (default: none) – allows excluding explicitly specified posts
    • Can be a comma-separated list of post IDs
    • Can be a Skeleton Expression

Sources

Section Source

Example

<posts
    source="frontpage"
    section_url="news"
    from_sections_other_than="politics,sport"
    order="primacy"
    limit="20"
/>

Attributes

  • section_url (default: none) – allows to specify a section to pull posts from
    • Can be a specific section name
    • Can be a Skeleton Expression
    • If not specified - Loads Home section posts on the Home Page - Loads current section posts on a Section Page
  • from_sections_other_than (default: none) – allows to exclude posts from specified sections
    • Can be a comma-separated list of section names
    • Can be a Skeleton Expression
  • order (default: recency)
    • recency – for the most recent results at the top
    • primacy – for the posts matched by Primary Section at the top

Tag Source

Example

<posts
    source="tag"
    tag_name="news"
    order="primacy"
    limit="20"
/>

Attributes

  • tag_name (default: none) – allows to specify a tag to pull posts by
    • Can be a specific tag name
    • Can be a Skeleton Expression
    • If not specified, loads current tag posts on a Tag Page
  • order (default: recency)
    • recency – for the most recent results at the top
    • primacy – for the posts matched by Primary Section at the top

Search Source

Example

<posts
    source="search"
    phrase="{{getparams.q}}"
    bucket="archived"
    [types filter]
    [sections_filter]
    order="relevancy"
    decay_speed="5"
    limit="20"
    cache_ttl_in_seconds="120"
/>

Attributes

  • phrase (default: value from q query parameter)
    • Can be a specific phrase
    • Can be a Skeleton Expression
  • bucket (default: none) – allows searching within a specific pre-defined bucket
    • Can be a specific bucket
  • [types filter] (see: Types Filter)
  • [sections filter] (see: Sections Filter)
  • order (default: relevancy)
    • recency – ignore relevancy completely
    • relevancy – consider relevancy of the results penalizing older results based on decay_speed
  • decay_speed (default: 10) – allows adjusting the order of the results in terms of actuality
    • 10 – the older results quickly become irrelevant
    • 0 – the age of the result doesn’t influence its actuality

Popular Source

Example

<posts
    source="popular"
    period="lifetime"
    [sections filter]
    limit="20"
/>

Attributes

  • period (default: 1h) – allows specifying period ending now for Page Views to be taken into the account
    • 12h – loads posts ordered by PVs from the last 12 hours
    • 7d – loads posts ordered by PVs from the last 7 days
    • lifetime – loads posts ordered by total number of PVs
  • [sections filter] (see: Sections Filter)

Notes

  • Posts from this tag are being loaded after all the other posts loaded

Filtered Source

Example

<posts
    source="filtered"
    [types filter]
    [statuses filter]
    [sections filter]
    [authors filter]
    [tags filter]
    [period filter]
    limit="20"
/>

Attributes

River Source

Example

<posts
    source="river"
    user_id="{{request.user.id}}"
    limit="20"
/>

Attributes

  • user_id – requires specifying a particular user ID for accessing River
    • Can be a user ID
    • Can be a Skeleton Expression

Stream Source

Example

<posts
    source="stream"
    bucket="~all~"
    type="popular"
    period="lifetime"
/>

Attributes

  • bucket – requires specifying a particular bucket of posts
  • type
    • popular – such streams contain posts ordered by PVs
    • movable – such streams initially contains posts ordered by publishing date but also are supposed to provide an ability to move the posts around manually
  • period – allows specifying period ending now for Page Views to be taken into the account in the case when type="popular"

Notes

  • This is still under development
  • It is aimed to replace most of the other sources

Multi Source

Example

<posts source="multi" limit="5">
    <source name="filtered" from_sections="politics" limit="3" />
    <source name="filtered" from_sections="politics" limit="3" />
</posts>

Notes

  • Allows to combine multiple sources

Filters

Types Filter

Example

<posts
    ...
    from_types="article"
    from_types_other_than="special"
    ...
/>

Attributes

  • from_types – allows including posts by specific types
    • Can be a comma separated list of types
    • Can be a Skeleton Expression
  • from_types_other_than – allows excluding posts by specific types
    • Can be a comma separated list of types
    • Can be a Skeleton Expression

Types

  • articleTBD
  • imageTBD
  • videoTBD
  • eventTBD
  • placeTBD
  • recipeTBD
  • productTBD
  • special – alias for event,place,recipe,product (subject to change)

Statuses Filter

Example

<posts
    ...
    from_statuses="published"
    from_statuses_other_than="featured,community"
    ...
/>

Attributes

  • from_statuses – allows including posts by specific statuses
    • Can be a comma separated list of statuses
    • Can be a Skeleton Expression
  • from_statuses_other_than – allows excluding posts by specific statuses
    • Can be a comma separated list of statuses
    • Can be a Skeleton Expression
  • If neither specified, applies from_statuses="roar" behavior

Statuses

  • adminTBD
  • featuredTBD
  • communityTBD
  • roar – alias for admin,featured
  • published – alias for admin,featured,community

Sections Filter

Examples

<posts
    ...
    from_sections_of_current_post="true"
    from_sections_other_than="politics,sport"
    ...
/>
<posts
    ...
    from_sections_of_current_post_other_than="news"
    from_sections_other_than="politics,sport"
    ...
/>
<posts
    ...
    from_sections="news"
    from_sections_other_than="politics,sport"
    ...
/>

Attributes

  • from_sections_of_current_post – allows including posts by any section of the current post
    • Can be true or false
  • from_sections_of_current_post_other_than – allows including posts by any section of the current post other the specified ones
    • Can be a comma separated list of section slugs
    • Can be a Skeleton Expression
  • from_sections – allows including posts by specific sections
    • Can be a comma separated list of section slugs
    • Can be a Skeleton Expression
  • from_sections_other_than – allows excluding posts by specific sections
    • Can be a comma separated list of section slugs
    • Can be a Skeleton Expression

Authors Filter

Examples

<posts
    ...
    from_authors_of_current_post="true"
    from_authors_other_than="john.doe,jane.roe"
    ...
/>
<posts
    ...
    from_authors_of_current_post_other_than="john.nokes"
    from_authors_other_than="john.doe,jane.roe"
    ...
/>
<posts
    ...
    from_authors="john.nokes"
    from_authors_other_than="john.doe,jane.roe"
    ...
/>

Attributes

  • from_authors_of_current_post – allows including posts by any author of the current post
    • Can be true or false
  • from_authors_of_current_post_other_than – allows including posts by any author of the current post other the specified ones
    • Can be a comma separated list of author slugs
    • Can be a Skeleton Expression
  • from_authors – allows including posts by specific authors
    • Can be a comma separated list of author slugs
    • Can be a Skeleton Expression
  • from_authors_other_than – allows excluding posts by specific authors
    • Can be a comma separated list of author slugs
    • Can be a Skeleton Expression

Tags Filter

Examples

<posts
    ...
    from_tags_of_current_post="true"
    from_tags_other_than="politics,sport"
    ...
/>
<posts
    ...
    from_tags="news"
    from_tags_other_than="politics,sport"
    ...
/>

Attributes

  • from_tags_of_current_post – allows including posts by any tag of the current post
    • Can be true or false
  • from_tags – allows including posts by specific tags
    • Can be a comma separated list of tags
    • Can be a Skeleton Expression
  • from_tags_other_than – allows excluding posts by specific tags
    • Can be a comma separated list of tags
    • Can be a Skeleton Expression

Period Filter

Examples

<posts
    ...
    period="12h"
    ...
/>
<posts
    ...
    period="7d"
    published_before_period="3d"
    ...
/>
<posts
    ...
    period="7d"
    published_before_current_post="true"
    ...
/>

Attributes

  • period (default: lifetime) – allows only including posts published within the specified period ending now
    • 12h – loads posts published during the last 12 hours
    • 7d – loads posts published during the last 7 days
  • published_before_period – allows excluding posts published within the specified period ending now
    • 12h – loads posts published not later than 12 hours ago
    • 7d – loads posts published not later than 7 days ago
  • published_before_current_post – allows excluding posts published after the current one
    • Can be true or false
  • published_before_current_post – allows excluding posts published after the current one
    • Can be true or false
  • published_after – allows include only posts published after the specified date
    • Can be <Year>, <Year>-<Month>, <Year>-<Month>-<Day>, or <Year>-<Month>-<Day> <Hours>-<Minutes>-<Seconds>
  • published_before – allows include only posts published before the specified date
    • Can be <Year>, <Year>-<Month>, <Year>-<Month>-<Day>, or <Year>-<Month>-<Day> <Hours>-<Minutes>-<Seconds>