getgrav / grav-plugin-sitemap

Grav Sitemap Plugin
https://getgrav.org
MIT License
42 stars 42 forks source link

Seems like not working... #33

Closed pbt39ppc closed 7 years ago

pbt39ppc commented 7 years ago

after installing, on the onelang non en site i see: http://mysite.name/sitemap

This page contains the following errors: error on line 1 at column 8: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.

and there is nothing below...

pbt39ppc commented 7 years ago

removing 1st line in the sitemap.xml.twig <?xml version="1.0" encoding="UTF-8"?>

fixed the issue (but i think that is too rough), google fing no errors in the sitemap.

flaviocopes commented 7 years ago

Do you have an empty line/space at the beginning of the sitemap?

pbt39ppc commented 7 years ago

now, yes. but without that empty linw works too.

pjfry84 commented 7 years ago

Hi I got the same error ... after deleting the first line of sitemap.xml.twig (with and without a blanc line) everything works fine now ....

rhukster commented 7 years ago

Where is this file coming from that has the blank line? The one in the plugin has no blank line. https://github.com/getgrav/grav-plugin-sitemap/blob/develop/templates/sitemap.xml.twig

pbt39ppc commented 7 years ago

This is workaround. 1) delete all in the first line, the line itself still there, so it's blank. or 2) delete all line, so the 2nd line became 1st.

pjfry84 commented 7 years ago

Yes I agree with pbt39ppc ... both solution are working. This is what I meant by saying:

with and without a blanc line

Of course in the original file there is no blank line

flaviocopes commented 7 years ago

Can one of you send me (also privately on Slack) your user/ folder to test? Because I cannot get that white space to show up in the first line.

flaviocopes commented 7 years ago

@pbt39ppc sent me the site to check. The problem was caused by the (custom) theme having two white spaces after the closing PHP tag. Those 2 spaces appeared before the twig template rendering, so they caused the issue.