Giter VIP home page Giter VIP logo

kirby-xml-sitemap's Introduction

Kirby XML Sitemap Release Issues

XML Sitemap is a powerful Kirby CMS plugin that generates a nice sitemap.xml for your site!

Kirby XML Sitemap screenshot

Main features

  • Cache support
  • Human-readable XML sitemap
  • Image attributes
  • Multi-language support
  • Powerful options

Requirements

  • Kirby 2.4.0+
  • PHP 5.4+

Installation

After installing the plugin using any of the methods below you should be able to visit https://yoursite.com/sitemap.xml to see an human-readable sitemap without any initial configuration.

Download

Download the files and place them inside site/plugins/xml-sitemap.

Kirby CLI

Kirby's command line interface makes installing the XML Sitemap a breeze:

$ kirby plugin:install pedroborges/kirby-xml-sitemap

Updating couldn't be any easier, simply run:

$ kirby plugin:update pedroborges/kirby-xml-sitemap

Git Submodule

You can add the XML Sitemap as a Git submodule.

$ cd your/project/root
$ git submodule add https://github.com/pedroborges/kirby-xml-sitemap.git site/plugins/xml-sitemap
$ git submodule update --init --recursive
$ git commit -am "Add XML Sitemap plugin"

Updating is as easy as running a few commands.

$ cd your/project/root
$ git submodule foreach git checkout master
$ git submodule foreach git pull
$ git commit -am "Update submodules"
$ git submodule update --init --recursive

Options

XML Sitemap works out of the box and most likely you won't need to change any option manually. However there are the following options in case you need to change the defaults:

// License URL for your site's images
c::set('sitemap.images.license', null);

// Enable/disable adding images to XML Sitemap
c::set('sitemap.include.images', true);

// Add/remove invisible pages
c::set('sitemap.include.invisible', false);

// URI of pages to remove
c::set('sitemap.ignored.pages', []);

// Template names to remove
c::set('sitemap.ignored.templates', []);

// or only include the following Templates
c::set('sitemap.allowed.templates', []);
// NOTE: You can only use ignored.templates or allowed.templates, not both.

// Show/hide change frequency attribute
// (see more below)
c::set('sitemap.frequency', false);

// Show/hide priority attribute
// (see more below)
c::set('sitemap.priority', false);

Extensions

sitemap.frequency

When this option is set to true the plugin will default to this function to determine the value of the changefreq attribute of URLs on your XML sitemap. You can pass a callback to use your own logic:

c::set('sitemap.frequency', function($page) {
    // You must return a string
    return $page->isHomePage() ? 'daily' : 'never';
});

sitemap.priority

When this option is set to true the plugin will default to this function to determine the value of the priority attribute of URLs on your XML sitemap. You can pass a callback to use your own logic:

c::set('sitemap.priority', function($page) {
    // You must return a floating point number between 0 and 1
    return $page->depth() === 1 ? 1 : 0.5;
});

sitemap.process

The XML Sitemap plugin includes options that are enough for most projects. However there are cases in which you need more control. This option allows you to process the pages collection in any way you want, such as removing or adding a specific set of pages.

// Add a page that was removed on the
// `sitemap.ignored.templates` option
c::set('sitemap.process', function($pages) {
    $shy = page('super-shy-page');

    return $pages->add($shy);
});

// Filter a set of pages based on a field value
c::set('sitemap.process', function($pages) {
    return $pages->filter(function($page) {
        // Remove future posts
        if ($page->intendedTemplate() === 'post') {
            return $page->date() < time();
        }

        // Keep all other pages
        return true;
    });
});

You can do any number of manipulation on the $pages collection.

Change Log

All notable changes to this project will be documented at: https://github.com/pedroborges/kirby-xml-sitemap/blob/master/changelog.md

License

XML Sitemap is open-sourced software licensed under the MIT license.

Copyright © 2017 Pedro Borges [email protected]

kirby-xml-sitemap's People

Contributors

mrunkel avatar pedroborges avatar

Watchers

 avatar  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.