Skip to content

Commit d31f49a

Browse files
committed
v.1.0.8
1 parent 1fb7576 commit d31f49a

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
Easy XML sitemap
22
===================================
33

4-
Generates XML sitemap conforming to [Google's recommendations](https://support.google.com/webmasters/answer/2620865)
4+
Provides XML sitemap conforming to [Google's recommendations](https://support.google.com/webmasters/answer/2620865)
55
for using "hreflang" attribute in sitemap on multilingual site and [sitemaps.org protocol](http://www.sitemaps.org/protocol.html).
66

77
Features
88
--------
9-
Generated sitemap is available at *http(s)://your.domain/sitemap.xml* and include URLs for:
9+
XML sitemap file is available at *http(s)://your.domain/sitemap.xml* and include URLs generated for:
1010

1111
- pages created by nodes;
1212
- non-empty taxonomy terms pages;
1313
- publicly available pages by "Views" module.
1414

15-
If one node is set as site's front page, direct URL to this node will be
15+
If some node is set as site's front page, direct URL to this node will be
1616
automatically excluded from sitemap to avoid content duplication.
1717

18-
URLs which you do not want include to sitemap may be excluded.
18+
You may exclude from sitemap:
1919

20-
Content which presented on any of available languages can be excluded from the sitemap.
20+
- specific URLs, for example 403/404 error pages;
21+
- all content which presented on any of available languages.
2122

2223
Each time sitemap re-built, backup copy of previous file state is saved as
2324
*public://easy_xmlsitemap/sitemap.xml.bak*
2425

2526
Less important and optional URLs attributes "priority" and "lastmod" are omitted in this version.
2627

28+
You can want add at end of your file robots.txt line:
29+
30+
Sitemap: *http(s)://your.domain/sitemap.xml*
31+
2732
Installation
2833
------------
2934
If you have file "sitemap.xml" in website root directory, please remove

config/easy_xmlsitemap.settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"sitemap_dir": "easy_xmlsitemap",
55
"rebuild_frequency": "daily",
66
"excluded_urls": "",
7-
"excluded_langs": []
7+
"excluded_langs": [],
8+
"force_https": 0
89
}

easy_xmlsitemap.admin.inc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,15 @@ function easy_xmlsitemap_settings_form() {
111111
function easy_xmlsitemap_settings_form_submit($form, &$form_state) {
112112
global $user;
113113
$config = config('easy_xmlsitemap.settings');
114-
114+
115115
if ($form_state['clicked_button']['#id'] == 'edit-submit') {
116116
$config->set('force_https', $form_state['values']['force_https']);
117117
$config->set('base_url', trim($form_state['values']['base_url']));
118118
$config->set('rebuild_frequency', $form_state['values']['rebuild_frequency']);
119119
$config->set('excluded_urls', trim($form_state['values']['excluded_urls']));
120-
$config->set('excluded_langs', $form_state['values']['excluded_langs']);
121-
120+
if (isset($form_state['values']['excluded_langs'])) {
121+
$config->set('excluded_langs', $form_state['values']['excluded_langs']);
122+
}
122123
$config->save();
123124
watchdog('easy_xmlsitemap', t('Settings changed by @user.', array('@user' => $user->name)));
124125
backdrop_set_message(t('Configuration settings have been saved.'));

easy_xmlsitemap.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ package = SEO
44
backdrop = 1.x
55
type = module
66
configure = admin/config/metadata/easy_xmlsitemap
7-
version = 1.0.7
7+
version = 1.0.8
88

easy_xmlsitemap.module

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,14 @@ function easy_xmlsitemap_language_list() {
7676
$config = config('easy_xmlsitemap.settings');
7777
$excluded_langs = $config->get('excluded_langs');
7878
$site_langs = language_list(TRUE);
79-
80-
foreach ($excluded_langs as $lang => $excluded) {
81-
if ($excluded !== 0) {
82-
unset($site_langs[$lang]);
79+
80+
if (!empty($excluded_langs)) {
81+
foreach ($excluded_langs as $lang => $excluded) {
82+
if ($excluded !== 0) {
83+
unset($site_langs[$lang]);
84+
}
8385
}
8486
}
85-
8687
return $site_langs;
8788
}
8889

@@ -391,7 +392,7 @@ function easy_xmlsitemap_output() {
391392
/** DEBUG
392393
$ua = getenv('HTTP_USER_AGENT');
393394
$ip = getenv('REMOTE_ADDR');
394-
watchdog('easy_xmlsitemap', 'Request for sitemap by ' . $ua . ' from ' . $ip, NULL, WATCHDOG_INFO);
395+
watchdog('easy_xmlsitemap', 'Request for sitemap.xml by ' . $ua . ' from ' . $ip, NULL, WATCHDOG_INFO);
395396
*/
396397
backdrop_add_http_header('Content-type', 'text/xml; charset=utf-8');
397398
backdrop_add_http_header('X-Robots-Tag', 'noindex, follow');

0 commit comments

Comments
 (0)