Closed Blucreation closed 3 years ago
I too needed this functionality, so I have opened this PR. I have tested it with one of my own sites and it works well. https://github.com/pecotamic/sitemap/pull/2
@Blucreation You can use my repo as a temporary fix until my PR is merged here:
Remove the original addon:
composer remove pecotamic/sitemap
Add this to your composer.json
file
{
...
"require": {
...
"pureartisan/sitemap": "dev-master"
...
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pureartisan/sitemap.git"
}
]
}
Install:
composer install
Update the config (same config file as before config\pecotamic\sitemap.php
):
return [
'url' => 'sitemap.xml',
'expire' => 60,
'include_entries' => true,
'include_terms' => true,
'include_collection_terms' => true,
/**
* - Leave as `null` for all types
* - Provide array of types/handles for filtering
*/
'entry_types' => [ 'pages', 'foo' ], // only include pages and foo
/**
* - Use valid regex patterns (uses `preg_match`)
* - Relative URLs (relative to site url)
*/
'exclude_urls' => [
'#^\/my-path\/.*#' // exclude all `/my-path/*`
]
];
Release 1.2.0 adds the changes by @prageeth
A simple array for omission of certain pages in config/pecotamic/sitemap.php would suffice