Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Google Sitemaps Module Parsing Error


Go to End


3 Posts   2755 Views

Avatar
airscool

Community Member, 4 Posts

26 March 2013 at 9:56pm

Edited: 26/03/2013 10:55pm

I have downloaded the latest version of the Google Sitemaps Module and uploaded the unpacked folder (named googlesitemaps) into the www folder.

I have then created a new folder under mysite called _config into which I have placed a file googlesitemaps.yml with the following content:

---
Name: customgooglesitemaps
After: googlesitemaps
---
GoogleSitemap:
enabled: true
objects_per_sitemap: 1000
google_notification_enabled: true
use_show_in_search: true

I have succesfully run /dev/build and rebuilt the database but upon visiting www.mysite.co.uk/sitemap.xml I get the following error:

XML Parsing Error: mismatched tag. Expected: </base>.
Location: http://www.mysite.co.uk/sitemap.xml
Line Number 11, Column 3:

</head>
--^

Am I missing something?

Addition: I have since attempted to run /dev/build and I now get the following error:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Unable to parse line 1 (---).' in /home/ardenhou/public_html/framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYamlParser.php:265 Stack trace: #0 /home/ardenhou/public_html/framework/core/manifest/ConfigManifest.php(211): sfYamlParser->parse('???---?Name: cu...') #1 [internal function]: SS_ConfigManifest->addYAMLConfigFile('googlesitemaps....', '/home/ardenhou/...', 2) #2 /home/ardenhou/public_html/framework/filesystem/FileFinder.php(158): call_user_func(Array, 'googlesitemaps....', '/home/ardenhou/...', 2) #3 /home/ardenhou/public_html/framework/core/manifest/ConfigManifest.php(141): SS_FileFinder->find('/home/ardenhou/...') #4 /home/ardenhou/public_html/framework/core/manifest/ConfigManifest.php(75): SS_ConfigManifest->regenerate(false) #5 /home/ardenhou/public_html/framework/core/Core.php(275): SS_ConfigManifest->__construct('/home/ardenhou/...', false, true) #6 /home/ardenhou/public_html/framework/ in /home/ardenhou/public_html/framework/thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYamlParser.php on line 265

Avatar
micahsheets

Community Member, 165 Posts

4 June 2013 at 7:23am

Edited: 04/06/2013 7:26am

Hello,

The dev/build error you are getting is a result of malformed yml code. It must be properly indented so instead of :

Name: customgooglesitemaps
After: googlesitemaps
---
GoogleSitemap:
enabled: true
objects_per_sitemap: 1000
google_notification_enabled: true
use_show_in_search: true

It should be:
Name: customgooglesitemaps
After: googlesitemaps
---
GoogleSitemap:
<space><space>enabled: true
<space><space>objects_per_sitemap: 1000
<space><space>google_notification_enabled: true
<space><space>use_show_in_search: true

Intents for yml must be 2 spaces. ( here shown as <space><space> since the post strips out the spaces if I put them in.

As far as the missing </base> tag, I am not sure how to fix that as even if I manually put the base tag into my page.ss file so that is has a nice closing tag it does not when rendered by Firefox.

I don't know why firefox does not properly close the <base> or <meta>tags but the xml parser expects closing tags at least on the <base> tag.

I am hoping that the maintainers of the googlesitemaps module can find a solution. One such solution would be to have the controller render the sitemap.xml with a custom template that we could format properly for the sitemap but not affect the rest of the site.

Avatar
figj

Community Member, 12 Posts

28 March 2015 at 2:43pm

Edited: 28/03/2015 2:46pm

I think your <base> tag problem is that SS is showing a normal page rather than the sitemap generated page.
(Your browser is giving an error because the content is HTML but the page name ends in .xml so it wants to interpret it as XML)

To fix, all I did was to flush the route - www.mysite.com/sitemap.xml?flush=1
(as mentioned in the readme on https://github.com/silverstripe-labs/silverstripe-googlesitemaps).