Skip to content
  1. Extras
  2. PageBuilder
  3. Section catalog
  4. Pro
  5. Blog posts

Blog posts ​

Automatic article feed: set blog parent, limit, and sort. Intros and thumbnails come from resources.

Blog posts

Информация

Requires PageBuilder Pro.

What the blog feed adds ​

  • Feed from child resources, no hand-rolled pdo in templates
  • Limit and sort in inspector
  • Intro and thumbnail toggles

Where to place ​

  • Blog homepage: latest posts
  • Site homepage: "From the blog" block
  • Landing: three recent articles

Page examples ​

Parent and limit ​

Blog parent: resource ID or picker. Limit, Sort, Show intro / image flags.

Similar sections ​

Block parameters ​

ParameterValue
keyblog_posts
LayerPro
Categorycontent (content)
Chunkpagebuilderpro_blog_posts
Requirespro

Inspector fields ​

Fill these fields in the section inspector. Field types are documented in the field types reference.

Title (title) ​

Type text. Optional.

Blog parent (parent) ​

Type relation. Required. Pick one MODX resource in a search modal.

Limit (limit) ​

Type number. Optional.

Show intro (show_intro) ​

Type yesno. Optional. Yes/no toggle.

Show image (show_image) ​

Type yesno. Optional. Yes/no toggle.

Sort (sortby) ​

Type select. Optional. publishedon_desc (newest first), publishedon_asc (oldest first), menuindex (menu order).

Layout (layout) ​

Type select. Optional. grid, featured-first, compact-list.

Site output ​

pb-blog-posts with article cards. An empty parent or an empty listing prints lexicon pagebuilder_fe_listing_empty_blog. The intro comes from introtext and shows only when show_intro is on. The image (TV image) shows only when show_image is on.

Section data ​

Example payload after save. Media, video, and map values may be enriched on output:

json
{
  "title": "Section title",
  "parent": 101,
  "limit": 6,
  "show_intro": true,
  "show_image": true,
  "sortby": "menuindex",
  "layout": "grid"
}

Chunk template ​

Fenom chunk pagebuilderpro_blog_posts:

fenom
{set $blogParent = $parent.id|default:($parent_id|default:0)}
{set $showIntro = $show_intro|default:0}
{set $showImage = $show_image|default:0}
{set $includeTvs = $showImage ? 'image' : ''}
{set $listing = ''}
{if $blogParent}
  {set $listing = $modx->runSnippet('pdoResources', [
    'parents' => $blogParent,
    'depth' => 1,
    'limit' => $limit|default:6,
    'sortby' => $blog_sortby|default:'publishedon',
    'sortdir' => $blog_sortdir|default:'DESC',
    'includeTVs' => $includeTvs,
    'tvPrefix' => '',
    'show_intro' => $showIntro,
    'show_image' => $showImage,
    'tpl' => 'pagebuilderpro_blog_post_row'
  ])}
{/if}
<section class="pb-section pb-section--blog-posts pb-blog-posts pb-blog-posts--{$layout|default:'grid'|escape}{if $cssClass} {$cssClass|escape}{/if}" data-pb-section="blog_posts"{if $id} id="pb-{$id|escape}"{/if}>
  <div class="pb-section__inner pb-blog-posts__inner">
    {if $title}
      <h2 class="pb-heading pb-blog-posts__title">{$title|escape}</h2>
    {/if}
    {if $listing}
      <div class="pb-blog-posts__listing">
        {$listing}
      </div>
    {else}
      <p class="pb-listing__empty">{'pagebuilder_fe_listing_empty_blog' | lexicon}</p>
    {/if}
  </div>
</section>

See also ​