servant-seo: Generate Robots.txt and Sitemap.xml specification for your servant API.

[ bsd3, library, servant, web ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0, 0.1.1, 0.1.2
Change log CHANGELOG.md
Dependencies aeson, base (>=4.7 && <5), binary, blaze-markup, bytestring, containers, http-media, lens (>=4.18.1), servant (>=0.16), servant-blaze, servant-server, text, warp, xml-conduit [details]
Tested with ghc ==8.6.5 || ==8.8.3
License BSD-3-Clause
Copyright Andrey Prokopenko (c) 2020
Author Andrey Prokopenko
Maintainer persiantiger@yandex.ru
Category Web, Servant
Home page https://github.com/swamp-agr/servant-seo#readme
Bug tracker https://github.com/swamp-agr/servant-seo/issues
Source repo head: git clone https://github.com/swamp-agr/servant-seo
Uploaded by swamp_agr at 2020-07-15T21:14:57Z
Distributions
Downloads 559 total (6 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for servant-seo-0.1.2

[back to package description]

servant-seo

Build Status

Hackage Status

Installation

  • Add servant-seo to project dependencies.

Usage

  1. Restrict API with Disallow combinator to prevent robots making requests.
type ProtectedAPI = Disallow "admin" :> Get '[HTML] AdminPage

type StaticAPI = "cdn" :> Disallow "static" :> Raw
  1. Add Priority and Frequency (optional step).
typw BlogAPI = "blog" :> Frequency 'Always :> Get '[HTML] BlogPage
  1. Extend your API with something like:
Warp.runSettings Warp.defaultSettings $ serveWithSeo website api server
where
  website = "https://example.com"

You will have /robots.txt and /sitemap.xml automatically generated and ready to be served with your API.

See Servant.Seo module for detailed description and example/Example.hs for show case.

Acknowledgements

This library would not have happened without these people. Thank you!

  • @fizruk and Servant Contributors: as source of inspiration.
  • @isovector: for Thinking with types book.