- Add
servant-seoto project dependencies.
- Restrict API with
Disallowcombinator to prevent robots making requests.
type ProtectedAPI = Disallow "admin" :> Get '[HTML] AdminPage
type StaticAPI = "cdn" :> Disallow "static" :> Raw- Add
PriorityandFrequency(optional step).
typw BlogAPI = "blog" :> Frequency 'Always :> Get '[HTML] BlogPage- 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.
This library would not have happened without these people. Thank you!
- @fizruk and Servant Contributors: as source of inspiration.
- @isovector: for
Thinking with typesbook.