flask-sitemapper


Nameflask-sitemapper JSON
Version 1.8.0 PyPI version JSON
download
home_pagehttps://github.com/h-janes/flask-sitemapper
SummaryFlask extension for generating XML sitemaps
upload_time2024-03-30 10:57:17
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
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/41/fc/283d80351f9b9274093be7ed2a9a10d1791db7c3d7c9f39eeb3370de89fa/flask_sitemapper-1.8.0.tar.gz",
    "platform": null,
    "description": "# Flask Sitemapper\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.0",
    "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": "657597c7a12ce19cd21b8d7f2e4a3e9185763e00546c94edd648f1fa5df7fd53",
                "md5": "5f415eb1ecce24841d4fa9f4be5c3bed",
                "sha256": "921eeecd6855b99990d4663ff4e9e31fe9dac0551a465f8b0811444ada18d6da"
            },
            "downloads": -1,
            "filename": "flask_sitemapper-1.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f415eb1ecce24841d4fa9f4be5c3bed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7403,
            "upload_time": "2024-03-30T10:57:15",
            "upload_time_iso_8601": "2024-03-30T10:57:15.869263Z",
            "url": "https://files.pythonhosted.org/packages/65/75/97c7a12ce19cd21b8d7f2e4a3e9185763e00546c94edd648f1fa5df7fd53/flask_sitemapper-1.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41fc283d80351f9b9274093be7ed2a9a10d1791db7c3d7c9f39eeb3370de89fa",
                "md5": "0ce6e2e05e513e7490bd072d71808358",
                "sha256": "e065f58db2ca089226fb8a1065863eef3cda9a0f24683904e5979caccacd8d5f"
            },
            "downloads": -1,
            "filename": "flask_sitemapper-1.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0ce6e2e05e513e7490bd072d71808358",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5849,
            "upload_time": "2024-03-30T10:57:17",
            "upload_time_iso_8601": "2024-03-30T10:57:17.022775Z",
            "url": "https://files.pythonhosted.org/packages/41/fc/283d80351f9b9274093be7ed2a9a10d1791db7c3d7c9f39eeb3370de89fa/flask_sitemapper-1.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-30 10:57:17",
    "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: 0.22476s