__init__.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:st2docs 作者: StackStorm 项目源码 文件源码
def create_sitemap(app, exception):
    """Generates the sitemap.xml from the collected HTML page links"""
    if (not app.config['html_theme_options'].get('base_url', '') or
        exception is not None or not app.sitemap_links):
        return

    filename = app.outdir + "/sitemap.xml"
    print "Generating sitemap.xml in %s" % filename

    root = ET.Element("urlset")
    root.set("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9")

    for link in app.sitemap_links:
        url = ET.SubElement(root, "url")
        ET.SubElement(url, "loc").text = link

    ET.ElementTree(root).write(filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号