Closed wernerb90 closed 7 years ago
Nice Idea.
I have added the --images flag to enable image sitemap.
Feel free to test it and make a return if you want some modification(s).
@c4software Amazing, thanks, will test it out now!
Hi @c4software
So I ran it on one of my sites, and seems there's a bit of a format issue.
Currently you're adding the
i.e. on the link I referenced in the original post you'll see an example:
`<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
`
Nice catch i miss that point!
I will look how i can achieve this (without create duplication in the sitemap, eg same image in every page)
Well, i look deeper, and image:loc should be repeat in every location if the image is present. So its more simpler than i expected.
Hi @c4software
Yes - I believe the most important part is just that the images/pages are associated correctly, which shouldn't be too massive of an issue.
Would the exclude path option work for these, as then one can exclude cosmetic images by folder - i.e.
/assets/img/ - this could contain cosmetic images, icons, etc /media/ or /uploads/ - this would contain images we want to tag as images in the sitemap.
so by excluding /assets/img/ all other images would be included?
Should be better now.
eg :
[…]
<url>
<loc>http://blog.lesite.us/el-capitan-personnaliser-la-disposition-de-clavier-du-login-screen.html</loc>
<lastmod>2016-07-13T14:36:32+00:00</lastmod>
<image:image>
<image:loc>http://blog.lesite.us/theme/images/avatar.jpg</image:loc>
</image:image>
</url>
[…]
Hi @c4software
Looks great, thanks, will check and revert.
I will rework on this issue to read the title attribute (if present) of the image to populate sitemap with it. Its optional but it will be better i think…
Hi @c4software
Looking great so far. <image:loc>
is now going in to the correct place, but I noticed images are still picked up as pages as well - i.e. <url><loc>
- not sure if that is accurate according to the spec?
Perhaps it's because my images has query string parameters? (images are dynamically sized, so they have "h" and "w" parameters after the filename...
Strange, do you have an example of url?
Example is, i.e.
I have managed to get the desired result by adding the --exclude "/imgs/"
parameter, as these images will always be under this path. i noticed exclude doesn't get checked for the --images
flag, which is perfect for my use case.
Strange... Image link are referenced inside a a
element ?
Hi @c4software
No - it's just div -> div -> div -> img
Hi,
Thanks for the feedback. I can’t reproduce the behavior, but i have made some modification. Can you test it again ?
Hi @c4software
THanks, will test the update. Some further feedback - the image sitemap failed validation with Google Webmaster Tools - this is because of the ampersands in my image URLs, they need to be escaped and presented as "&" .... or to wrap that URL in CDATA tags.
A stackoverflow reference for the error is below, as it's just xml parsing in this instance. http://stackoverflow.com/questions/23422316/xml-validation-error-entityref-expecting
Ah yes you're right. I made the first version to fast...
I will make the modification tomorrow morning. I just forgot case like yours
Hi,
Should be better now.
For me its fixed.
Feel free to reopen if you find any more related issue.
Hi,
Would you consider adding support for images in the future?
i.e. https://support.google.com/webmasters/answer/178636?hl=en