Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from Dolphiq/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
johanzandstra authored Jan 18, 2018
2 parents 1439836 + 9d65a25 commit b8df180
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# sitemap Changelog

## 1.0.6 - 2018-01-18
### Changed
- Use the siteUrl from the general config as prefered base URL
- Checked compatibility with Craft RC6

## 1.0.5 - 2017-12-18
### Fixed
- Fixed bug if there are no sections or categories in the website
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The sitemap is compatible with the ![sitemaps.org](https://www.sitemaps.org/prot

## Requirements

This plugin requires Craft CMS 3.0.0-RC1 or later.
This plugin requires Craft CMS 3.0.0-RC6 or later.

## Installation

Expand All @@ -35,7 +35,7 @@ To install the plugin, follow these instructions.

## XML-sitemap Roadmap
- User (custom) url entry section
- Privide a way hide entries from the list
- Provide a way hide entries from the list
- Add a Ping for search engines
- Display the last 20 visits from search engines

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dolphiq/sitemap",
"description": "Craft 3 plugin that provides an easy way to provide and manage a XML sitemap for search engines like Google and Bing",
"type": "craft-plugin",
"version": "1.0.5",
"version": "1.0.6",
"keywords": [
"craft",
"cms",
Expand All @@ -22,7 +22,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1",
"craftcms/cms": "^3.0.0-RC6",
"jaybizzle/crawler-detect": "1.*"
},
"repositories": [
Expand Down
14 changes: 9 additions & 5 deletions src/controllers/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ public function actionIndex()
$urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$dom->appendChild($urlset);

$siteurl = isset(Craft::$app->config->general)
&& isset(Craft::$app->config->general->siteUrl)
? Craft::$app->config->general->siteUrl
: null;

foreach($this->_createEntrySectionQuery()->all() as $item) {

$loc = rtrim($item['baseurl'], '/ ') . '/' . ($item['uri'] === '__home__' ? '' : $item['uri']);
$baseurl = rtrim($siteurl ?: $item['baseurl'], '/') . '/';
$loc = $baseurl . ($item['uri'] === '__home__' ? '' : $item['uri']);

$url = $dom->createElement('url');
$urlset->appendChild($url);
Expand All @@ -98,8 +102,8 @@ public function actionIndex()
}

foreach($this->_createEntryCategoryQuery()->all() as $item) {

$loc = rtrim($item['baseurl'], '/ ') . '/' . ($item['uri'] === '__home__' ? '' : $item['uri']);
$baseurl = rtrim($siteurl ?: $item['baseurl'], '/') . '/';
$loc = $baseurl . ($item['uri'] === '__home__' ? '' : $item['uri']);

$url = $dom->createElement('url');
$urlset->appendChild($url);
Expand Down Expand Up @@ -163,4 +167,4 @@ private function _createEntryCategoryQuery(): Query

}

?>
?>

0 comments on commit b8df180

Please sign in to comment.