flask-sitemapper


Nameflask-sitemapper JSON
Version 1.8.1 PyPI version JSON
download
home_pagehttps://github.com/h-janes/flask-sitemapper
SummaryFlask extension for generating XML sitemaps
upload_time2024-09-12 19:32:22
maintainerNone
docs_urlNone
authorh-janes
requires_python>=3.8
licenseMIT
keywords python3 flask sitemap xml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flask Sitemapper
![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-sitemapper)

Flask Sitemapper is a Python 3 package that generates XML sitemaps for Flask applications. This allows you to create fully functional sitemaps and sitemap indexes for your Flask projects with minimal code.

You can install the [latest version](https://pypi.org/project/flask-sitemapper/) of Flask Sitemapper with pip:
```terminal
pip install flask-sitemapper
```

For documentation (including for contributors), see [the wiki](https://github.com/h-janes/flask-sitemapper/wiki).

# Features
* Easily generate and serve XML sitemaps and sitemap indexes for your Flask apps
* Include URLs in your sitemaps by adding a decorator to their route/view functions
* Serve your sitemap on any URL you choose
* Include lastmod, changefreq, and priority information in your sitemaps
* Specify whether to use HTTP or HTTPS for the URLs in your sitemaps
* Compress your sitemaps using GZIP
* Create multiple sitemaps and sitemap indexes for the same app
* Supports apps using Flask blueprints
* Supports apps serving multiple domains
* Supports dynamic routes
* Works with many different app structures

# Sitemaps
> Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site.
> &mdash; <cite>[sitemaps.org](https://www.sitemaps.org)</cite>

For more information about sitemaps and the sitemap protocol, visit [sitemaps.org](https://www.sitemaps.org)

# Basic Code Example
```python
import flask
from flask_sitemapper import Sitemapper

sitemapper = Sitemapper()

app = flask.Flask(__name__)
sitemapper.init_app(app)

@sitemapper.include(lastmod="2022-02-08")
@app.route("/")
def home():
  return flask.render_template("home.html")

@sitemapper.include(lastmod="2022-03-19")
@app.route("/about")
def about():
  return flask.render_template("about.html")

@app.route("/sitemap.xml")
def sitemap():
  return sitemapper.generate()

app.run()
```

With the above code running on localhost, `http://localhost/sitemap.xml` will serve the following XML sitemap:
```xml
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://localhost/</loc>
    <lastmod>2022-02-08</lastmod>
  </url>
  <url>
    <loc>https://localhost/about</loc>
    <lastmod>2022-03-19</lastmod>
  </url>
</urlset>
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/h-janes/flask-sitemapper",
    "name": "flask-sitemapper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python3, flask, sitemap, xml",
    "author": "h-janes",
    "author_email": "dev@hjanes.com",
    "download_url": "https://files.pythonhosted.org/packages/9d/bf/5c36b5f560c7c302669ed1402483714e9ac5b6aaeb7d9e4c1ef36c2daa2a/flask_sitemapper-1.8.1.tar.gz",
    "platform": null,
    "description": "# Flask Sitemapper\n![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-sitemapper)\n\nFlask Sitemapper is a Python 3 package that generates XML sitemaps for Flask applications. This allows you to create fully functional sitemaps and sitemap indexes for your Flask projects with minimal code.\n\nYou can install the [latest version](https://pypi.org/project/flask-sitemapper/) of Flask Sitemapper with pip:\n```terminal\npip install flask-sitemapper\n```\n\nFor documentation (including for contributors), see [the wiki](https://github.com/h-janes/flask-sitemapper/wiki).\n\n# Features\n* Easily generate and serve XML sitemaps and sitemap indexes for your Flask apps\n* Include URLs in your sitemaps by adding a decorator to their route/view functions\n* Serve your sitemap on any URL you choose\n* Include lastmod, changefreq, and priority information in your sitemaps\n* Specify whether to use HTTP or HTTPS for the URLs in your sitemaps\n* Compress your sitemaps using GZIP\n* Create multiple sitemaps and sitemap indexes for the same app\n* Supports apps using Flask blueprints\n* Supports apps serving multiple domains\n* Supports dynamic routes\n* Works with many different app structures\n\n# Sitemaps\n> Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site.\n> &mdash; <cite>[sitemaps.org](https://www.sitemaps.org)</cite>\n\nFor more information about sitemaps and the sitemap protocol, visit [sitemaps.org](https://www.sitemaps.org)\n\n# Basic Code Example\n```python\nimport flask\nfrom flask_sitemapper import Sitemapper\n\nsitemapper = Sitemapper()\n\napp = flask.Flask(__name__)\nsitemapper.init_app(app)\n\n@sitemapper.include(lastmod=\"2022-02-08\")\n@app.route(\"/\")\ndef home():\n  return flask.render_template(\"home.html\")\n\n@sitemapper.include(lastmod=\"2022-03-19\")\n@app.route(\"/about\")\ndef about():\n  return flask.render_template(\"about.html\")\n\n@app.route(\"/sitemap.xml\")\ndef sitemap():\n  return sitemapper.generate()\n\napp.run()\n```\n\nWith the above code running on localhost, `http://localhost/sitemap.xml` will serve the following XML sitemap:\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://localhost/</loc>\n    <lastmod>2022-02-08</lastmod>\n  </url>\n  <url>\n    <loc>https://localhost/about</loc>\n    <lastmod>2022-03-19</lastmod>\n  </url>\n</urlset>\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Flask extension for generating XML sitemaps",
    "version": "1.8.1",
    "project_urls": {
        "Documentation": "https://github.com/h-janes/flask-sitemapper/wiki",
        "Homepage": "https://github.com/h-janes/flask-sitemapper",
        "Repository": "https://github.com/h-janes/flask-sitemapper"
    },
    "split_keywords": [
        "python3",
        " flask",
        " sitemap",
        " xml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "76c536dc6ea8010ca98952e3c758cc57aa1793242822667472f3a53a7db3e87c",
                "md5": "48bbd81eca8c8bcccc8721e659150b62",
                "sha256": "2210565cdf66817f5dc316583fce1ea1d1377bbb2e986f5ac101f89ce5b9a710"
            },
            "downloads": -1,
            "filename": "flask_sitemapper-1.8.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48bbd81eca8c8bcccc8721e659150b62",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7481,
            "upload_time": "2024-09-12T19:32:20",
            "upload_time_iso_8601": "2024-09-12T19:32:20.792736Z",
            "url": "https://files.pythonhosted.org/packages/76/c5/36dc6ea8010ca98952e3c758cc57aa1793242822667472f3a53a7db3e87c/flask_sitemapper-1.8.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9dbf5c36b5f560c7c302669ed1402483714e9ac5b6aaeb7d9e4c1ef36c2daa2a",
                "md5": "dd6a3186072d1468cbf361b3df385b75",
                "sha256": "835276b83f5301d59a0c55d615218e6a2db1c686c25ca8f3ac0fd60f41dacf1e"
            },
            "downloads": -1,
            "filename": "flask_sitemapper-1.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dd6a3186072d1468cbf361b3df385b75",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5917,
            "upload_time": "2024-09-12T19:32:22",
            "upload_time_iso_8601": "2024-09-12T19:32:22.115303Z",
            "url": "https://files.pythonhosted.org/packages/9d/bf/5c36b5f560c7c302669ed1402483714e9ac5b6aaeb7d9e4c1ef36c2daa2a/flask_sitemapper-1.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-12 19:32:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "h-janes",
    "github_project": "flask-sitemapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flask-sitemapper"
}
        
Elapsed time: 1.44783s