Git Product home page Git Product logo

sitemap-plugin's Introduction

Sitemap generator plugin

This plugin will a generate sitemap.xml file in October CMS based on desired CMS pages and others.

Viewing the sitemap

Once this plugin is installed and the sitemap has been configured. The sitemap can be viewed by accessing the file relative to the website base path. For example, if the website is hosted at https://octobercms.com it can be viewed by opening this URL:

https://octobercms.com/sitemap.xml

Managing a sitemap definition

The sitemap is managed by selecting Sitemap from the Settings area of the back-end. There is a single sitemap definition for each theme and it will be created automatically.

A sitemap definition can contain multiple items and each item has a number of properties. There are common properties for all item types, and some properties depend on the item type. The common item properties are Priority and Change frequency. The Priority defines the priority of this item relative to other items in the sitemap. The Change frequency defines how frequently the page is likely to change.

Standard item types

The available item types depend on the installed plugins, but there are three basic item types that are supported out of the box.

URL {.subheader}

Items of this type are links to a specific fixed URL. That could be an URL of an or internal page. Items of this type don't have any other properties - just the title and URL.

Static page {.subheader}

Items of this type refer to static pages. The static page should be selected in the Reference drop-down list described below.

All static pages {.subheader}

Items of this type expand to create links to all static pages defined in the theme.

Custom item types

Other plugins can supply new item types. For example, the Blog plugin by RainLab supplies two more types:

Blog category {.subheader}

An item of this type represents a link to a specific blog category. The category should be selected in the Reference drop-down. This type also requires selecting a CMS page that outputs a blog category.

All blog categories {.subheader}

An item of this time expands into multiple items representing all blog existing categories. This type also requires selecting a CMS page.

Definition item properties

Depending on the selected item time you might need to provide other properties of the item. The available properties are described below.

Reference {.subheader}

A drop-down list of objects the item should refer to. The list content depends on the item type. For the Static page item type the list displays all static pages defined in the system. For the Blog category item type the list displays a list of blog categories.

Allow nested items {.subheader}

This checkbox is available only for item types that suppose nested objects. For example, static pages are hierarchical, and this property is available for the Static page item type. On the other hand, blog categories are not hierarchical, and the checkbox is hidden.

CMS Page {.subheader}

This drop-down is available for item types that require a special CMS page to refer to. For example, the Blog category item type requires a CMS page that hosts the blogPosts component. The CMS Page drop-down for this item type will only display pages that include this component.


The Sitemap plugin works out of the box and does not require any direct development to operate.

Registering new sitemap definition item types

The Sitemap plugin shares the same events for registering item types as the Pages plugin. See the documentation provided by this plugin for more information.

A small addition is required when resolving items, via the following event:

  • pages.menuitem.resolveItem event handler "resolves" a menu item information and returns the actual item URL, title, an indicator whether the item is currently active, and subitems, if any.
Resolving items

When resolving an item, each item should return an extra key in the array called mtime. This should be a Date object (see Carbon\Carbon) or a timestamp value compatible with PHP's date() function and represent the last time the link was modified.

Expected result format:

Array (
    [url] => https://example.com/blog/category/another-category
    [mtime] => Carbon::now(),
    [items] => Array (
        [0] => Array (
            [url] => https://example.com/blog/category/another-category
            [mtime] => Carbon::now(),
        )

        [1] => Array (
            [url] => https://example.com/blog/category/news
            [mtime] => Carbon::now(),
        )
    )
)

sitemap-plugin's People

Contributors

acasar avatar anik1ng avatar blazorazem avatar daftspunk avatar diraulo avatar emzet avatar gergo85 avatar jh2odo avatar lemax10 avatar luketowers avatar magiczne avatar mahony0 avatar matissjanis avatar mjauvin avatar mohsin avatar mr118 avatar raank avatar ribsousa avatar samuell1 avatar theservat avatar vojtasvoboda avatar zek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.