Skip to content

Collection Examples

Johan Janssens edited this page Mar 10, 2021 · 14 revisions

Table of contents

RSS feed

Joomlatools Pages has a built-in template for RSS feeds. The built-in feed template offers support for the RSS specification: https://validator.w3.org/feed/docs/rss2.html

The item image is embedded using media RSS specification: http://www.rssboard.org/media-rss and is not injected into the description. The channel or item description is based on the page or item summary and does not contain HTML entities.

To create your own feed, create a page for the feed and import the built-in template and define the collection for the pages you want to have included in the feed.

For example, to create a feed of all blog posts in the /pages/blog directory add following page /pages/blog/index.rss.php

---
title: My Site Blog 
summary: There's lots happening on my site, our blog will keep you up-to-date.
collection:
   state:
        path: blog
        recurse: false
        limit: 20
        sort: date
        order: desc
        collection: false
visible: false
---

<?= import('com:pages.collection.newsfeed.rss'); ?>

XML Sitemap

Joomlatools Pages has a built-in template for sitemaps. The built-in template offers support for the Sitemaps specification and includes the <loc>and <lastmod>xml elements for each URL.

To create your own sitemap, all you need to do is create a page for the sitemap, import the built-in template and define the collection for the pages you want to have included in the sitemap.

For example, to create a sitemap of all pages in your site, add following page /pages/sitemap.xml.php

---
title: Sitemap
collection:
    state:
        path: .
        limit: 0
        sort: date
        order: desc
        recurse: false
visible: false
metadata:
    robots: [noindex]
---

<?= import('com:pages.collection.sitemap.xml'); ?>

Adding pages to the sitemap

By default, all pages will be added to the sitemap. To exclude a certain page from the sitemap, simply add robots: [noindex] to the page's frontmatter.

---
title: My Page
metadata:
    robots: [noindex]
---