Git Product home page Git Product logo

sitemap's Introduction

PHP Sitemap generator for websites

Author - Denis Mitrofanov

TheCollection.ru

Version 1.0.0

Usage

This program crwawls the entire website storing links, priorities and update periods.

$sitemap = new Sitemap('http://moskvado.ru/');
$sitemap
    ->setExcluded(['http://moskvado.ru/dashboard/', 'http://moskvado.ru/register/', 'http://moskvado.ru/login/'])
    ->setLevel(0, 1, 'daily')
    ->setLevel(1, 0.80, 'weekly')
    ->setLevel(2, 0.64, 'weekly')
    ->setLevel(3, 0.64, 'monthly')
    ->setDefaultUpdatePeriod('monthly')
    ->setMinimalProirity(0.5);


    $links = $sitemap->generate();
    $links->toXmlFile('sitemap.xml');

First you set the website you want to parse, than set the routes you want to exclude. Levels are set from 0 as domain root, to the third level, everything else should be set as minimalPriority (default is 0.64). Default update period is set to 'monthly'.

When you run $sitemap->generate() it return a LinksCollection object. Than you can persist it to actual sitemap.xml file. By runnig $links->toXmlFile('sitemap.xml') of course you can specify full path, and not just the file name.

The output will contain xml with line for every detected link like following:

<url>
    <loc>http://moskvado.ru/kompyutery-i-it-uslugi/orgtekhnika/</loc>
    <changefreq>weekly</changefreq>
    <priority>0.64</priority>
</url>

Resources that use this generator are:

sitemap's People

Contributors

denismitr avatar

Watchers

James Cloos 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.