Thanks for the link and that makes more sense and puts things into more content for me. I am still having issues though, here is what I now have after following your guide.
So I have a sitemap.php file in the root with the following code...
As Drew said you are declaring the XML twice, as it is included in both the sitemap.html and sitemap-blog.html templates. You will see on Clive's example he has included this on the page rather than in the templates themselves, to avoid this repetition. I think you need something like this (though not tested it):
But I used the exact code and it did not work. I was hoping Perch would be OK to use without knowing any PHP as I am a Designer not a coder.
For now I will have to leave the blog posts out!
Hi Sarah,
Clive has written a good run-through of creating sitemaps that include Blog posts, you can find it here:
https://www.cvwdesign.com/blog/creating-google-sitemaps-with-perch
Hope that helps a bit
Hi Mike
Thanks for the link and that makes more sense and puts things into more content for me. I am still having issues though, here is what I now have after following your guide.
So I have a sitemap.php file in the root with the following code...
Then I have a sitemap.html file saved in templates/navigation with the following code...
And a separate file called sitemap-blog.html saved in templates/blog with the following code...
No when I go to https://www.whittledesignstudio.com/sitemap.php I get errors.
You appear to have two XML documents, rather than one. You only need one of these at the start:
and then one of these at the end:
You'll need to update your templates so that it all becomes one cohesive set.
Hi Drew,
This is what the instructions say to do on the link provided by Mike.
You currently have two XML documents, and Drew's reply explains what you need to do to fix the problem.
I have one file in the root called sitemap.php with the following code...
<?php header('Content-type: application/xml'); include('perch/runtime.php'); perch_pages_navigation(array( 'template'=>'sitemap.html', 'flat' => true, 'hide-extensions' => true ));
echo '</urlset>'; ?>
The two html files it refers to are separate files in the templates folder as per the instructions from Mike.
I just do not know why this has to be so complicated!
Hi Sarah,
As Drew said you are declaring the XML twice, as it is included in both the
sitemap.html
andsitemap-blog.html
templates. You will see on Clive's example he has included this on the page rather than in the templates themselves, to avoid this repetition. I think you need something like this (though not tested it):sitemap.html
sitemap-blog.html
Thanks Mike, that has done it!
I just did not know what went where as I am not too familiar with PHP etc...
Thanks for your help
No worries - if you get chance mark that as the solution, I am trying to catch Drew's points score :)
Thanks Mike, just done it