Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Created March 5, 2015 05:27
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lostsnow/5e941f5ba5701cdd4aec to your computer and use it in GitHub Desktop.
Save lostsnow/5e941f5ba5701cdd4aec to your computer and use it in GitHub Desktop.
Farbox sitemap template, visit by /sitemap
doctype xml
set_content_type('text/xml')
date_format = "%Y-%m-%dT%H:%M:%S+00:00"
posts = get_data(type="post", status=['public', 'secret'], limit=300)
//
This is a XML sitemap file. Which is supported by many search engines like Google.
You can find more information about XML sitemap on `http://sitemaps.org`.
urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9")
url
loc= "http://" + site.domain
lastmod
{{ posts[0].date.format(date_format) }}
changefreq weekly
priority 1.0
if has('posts')
url
loc= "http://" + site.domain + "/archive"
lastmod
{{ posts[0].date.format(date_format) }}
changefreq monthly
priority 1.0
if site.tags
url
loc= "http://" + site.domain + "/tags"
lastmod
{{ posts[0].date.format(date_format) }}
changefreq monthly
priority 1.0
about = get_doc('about.md') or get_doc('about.txt')
if about
url
loc= "http://" + site.domain + "/about"
lastmod
{{ about.date.format(date_format) }}
changefreq monthly
priority 1.0
for post in posts
url
loc= "http://" + site.domain + post.url
lastmod
{{ post.date.format(date_format) }}
changefreq monthly
priority 0.7
for tag in site.tags
url
loc= "http://" + site.domain + "/tag/" + tag[0]
lastmod
{{ posts[0].date.format(date_format) }}
changefreq monthly
priority 0.4
@orangex
Copy link

orangex commented Mar 14, 2016

想问下这是怎么用的啊,直接向google提交这个文件作为sitemap吗(T_T),求教

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment