Forum
Identify homepage in sitemap (and set right modified date and time format)
Hi, I wasn't really sure how to word my thread title!
Basically, I'm using the simple sitemap that is details in the docs here but i wanted to add a few extra bits of info.
So my template looks like this right now:
<url>
<loc>https://salonsaver.co.uk<perch:pages id="pagePath" /></loc>
<lastmod><perch:pages id="pageModified" /></lastmod>
</url>
That works just fine! However i want to add the <priority></priority> tag in there too... and that is where I'm stuck!
What I'd like to do is do something like "If pagePath is homepage then <priority>1.0</priority>, else <priority>0.2</priority>" but i can't for the life of me er out the syntax :^\
EDIT: Something else i just realised! The time / date format that is spat out by the template above is making google webmaster tools flag it up as "incorrect format". It appears to be looking for "2015-11-26T16:47:29+00:00" Any ideas on how i can do that too?
You can use the
format
attribute to format the date and time.To set the priority, how about using page attributes?
Hi Drew,
Ah ok, sounds like a plan! So i had a look in the docs for that and i can see how to set the correct format... like this:
But no idea how on earth i output that to my page!
As you saw, i was doing it like this:
So how would i use the perch_page_modified array from above? Sorry if that sounds thick! I've been working on entirely different projects recently, not using perch (unfortunately!) so my brain isn't in Perch mode!
And... yeah that's a smart idea! I like it. Page attributes it is! Thank you :^)
Like this:
Ah, simple as that! ~slaps forehead~ Cool, thanks a lot Drew :^)