-
-
Save MHerbst/5690874 to your computer and use it in GitHub Desktop.
<koken:variable name="m1" value="<" /> | |
<koken:variable name="m2" value="?" /> | |
{{ m1 }}{{ m2 }}xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
<koken:load source="essays"> | |
<koken:loop> | |
<url> | |
<loc>{{ essay.url }}</loc> | |
<lastmod>{{ essay.modified_on.timestamp date_format="Y-m-d"}}</lastmod> | |
<changefreq>weekly</changefreq> | |
<priority>0.5</priority> | |
</url> | |
</koken:loop> | |
</koken:load> | |
<koken:load source="pages"> | |
<koken:loop> | |
<url> | |
<loc>{{ page.url }}</loc> | |
<lastmod>{{ page.modified_on.timestamp date_format="Y-m-d"}}</lastmod> | |
<changefreq>weekly</changefreq> | |
<priority>0.6</priority> | |
</url> | |
</koken:loop> | |
</koken:load> | |
<koken:load source="albums"> | |
<koken:loop> | |
<url> | |
<loc>{{ album.url }}</loc> | |
<lastmod>{{ album.created_on.timestamp date_format="Y-m-d"}}</lastmod> | |
<changefreq>weekly</changefreq> | |
<priority>0.6</priority> | |
</url> | |
</koken:loop> | |
</koken:load> | |
<koken:load source="contents"> | |
<koken:loop> | |
<url> | |
<loc>{{ content.url }}</loc> | |
<lastmod>{{ content.captured_on date_format="Y-m-d"}}</lastmod> | |
<changefreq>weekly</changefreq> | |
<priority>0.6</priority> | |
<image:image> | |
<image:loc>{{ content.presets.medium.url }}</image:loc> | |
<image:title>{{ content.title | content.caption }}</image:title> | |
<image:caption>{{ content.caption | content.title }}</image:caption> | |
<koken:iptc> | |
<koken:not empty="iptc.city"><image:geo_location>{{ iptc.city }}<koken:not empty="iptc.country">, {{ iptc.country }}</koken:not></image:geo_location></koken:not> | |
</koken:iptc> | |
<image:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</image:license> | |
</image:image> | |
</url> | |
</koken:loop> | |
</koken:load> | |
</urlset> |
Doesn't work on koken 0.9.3 because the html response begin with <html><head></head><body>...
Xml sitemap can't be read with google webmaster
Please excuse my late answers. I have tried the sitemap.lens with koken 0.9.5 and the sitemap was not surrounded by html tags. Maybe this happend only in this one Koken version?
Hallo Carsten,
Reaktion kommt etwas spät. Hatte Deinen Kommentar leider gerade erst gesehen. Ich habe das File mal geändert und die Uhrzeit entfernt. Damit beschwert sich Google dann nicht mehr.
Viele Grüße
Martin
Hallo Martin,
soweit war ich auch schon, dass ich am Ende die Zeiten rausgenommen habe. Dannach scheint alles wunderbar von Seitens Google her zu laufen. Bing scheint das ganze jedoch noch nicht Akzeptieren da gibt es dann folgende Fehlermeldung:
Fehler beim Herunterladen der Siteübersicht bzw. des Feeds
Fehler beim Download dieser Siteübersicht. Bitte überprüfen Sie die Siteübersicht auf Fehler, und reichen Sie sie erneut ein.
Habe jetzt die Ursache des Problems bei Bing gefunden. Koken unterdrückt die erste Zeile der Sitemap und somit fehlt dann das encoding. Leider gibt Bing ja auch keine gescheiten Informationen zur Problemursache aus. Musste jetzt diverse Dienste, die Sitemaps validieren, ausprobieren. Google scheint das jedenfalls egal zu sein.
Muss mal schauen ob ich dafür noch eine Lösung finde.
Habe einen dirty Trick gefunden, um das encoding ausgeben zu können. Mal schauen ob Bing damit klar kommt.
Actually koken stripes '<?' so instead including an additional file you can simply do:
<koken:variable name="one" value="<" />
<koken:variable name="two" value="?" />
{{ one }}{{ two }}xml version="1.0" encoding="UTF-8"?>
Thanka pulponair for this hint. I have modified the code accordingly. I have also modified the output for images.
Unfortunately the number of images returned by koken:load is limited to 100, so I will probably have to find a better solution.
Habe gerade gesehen, das es eine bessere Lösung gibt: https://github.com/pulponair/koken-xml-sitemap
Das stimmt ;>
Hallo Martin,
danke für dein Snippet für Koken. Ich habe das ganze bei mir auf der Seite Implementiert, jedoch meckert google webmaster tools noch mit folgendem Fehler :
"Es wurde ein ungültiges Datum gefunden. Berichtigen Sie bitte das Datum bzw. dessen Formatierung, bevor Sie Ihre Daten erneut einreichen."
Kann man das Ignorieren oder führt das Probleme? Ich habe bisher keine Lösung gefunden.
Viele Grüße
Carsten