123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- moved = (from, to) ->
- { from: from, to: '_show/moved', query: {loc: to} }
- movedPattern = (from, to) ->
- { from: from, to: '_show/moved_pattern', query: {loc: to} }
- module.exports = [
- # Static files from the root
- { from: '/static/*', to: 'static/*' }
- # Dynamic site rendering used with a virtual host like:
- # www.somesite.com = /kleks/_design/site/_rewrite/render/www.somesite.com
- {
- from: '/render/:site',
- to: '_list/home/docs_for_home',
- query: {
- startkey: [':site', {}],
- endkey: [':site'],
- descending: 'true'
- }
- }
- # Some routes to static files needed under the dynamic site path
- { from: '/render/:site/static/*', to: 'static/*' }
- { from: '/render/:site/modules.js', to: 'modules.js' }
- { from: '/render/:site/duality.js', to: 'duality.js' }
- # Collection page - list of docs
- {
- from: '/render/:site/collection/:slug',
- to: '_list/collection/docs_by_collection',
- query: {
- startkey: [':site', ':slug', {}],
- endkey: [':site', ':slug'],
- descending: 'true',
- include_docs: 'true'
- }
- }
- # Collection JSON view - list of docs ONLY
- # {
- # from: '/render/:site/json/collection/:slug',
- # to: '_view/docs_by_collection',
- # query: {
- # startkey: [':site', ':slug', 'doc', {}],
- # endkey: [':site', ':slug', 'doc'],
- # descending: 'true',
- # include_docs: 'true'
- # }
- # }
- # Collection JSON view - all related rows
- {
- from: '/render/:site/json/collection/:slug',
- to: '_view/docs_by_collection',
- query: {
- startkey: [':site', ':slug', {}],
- endkey: [':site', ':slug'],
- descending: 'true',
- include_docs: 'true'
- }
- }
- # Collection's Sponsor JSON view - sponsor ONLY
- # {
- # from: '/render/:site/json/collection-sponsor/:slug',
- # to: '_view/docs_by_collection',
- # query: {
- # key: [':site', ':slug', 'sponsor', {}],
- # include_docs: 'true'
- # }
- # }
- # Search JSON endpoint
- {
- from: '/render/:site/json/search',
- to: '_search/site_docs'
- }
- # Essay content page
- {
- from: '/render/:site/essay/:slug',
- to: '_list/doc/docs_by_slug',
- query: {
- startkey: [':site', 'essay', ':slug'],
- endkey: [':site', 'essay', ':slug', {}],
- include_docs: 'true'
- }
- }
- # Scene content page
- {
- from: '/render/:site/scene/:slug',
- to: '_list/doc/docs_by_slug',
- query: {
- startkey: [':site', 'scene', ':slug'],
- endkey: [':site', 'scene', ':slug', {}],
- include_docs: 'true'
- }
- }
- # Video content page
- {
- from: '/render/:site/video/:slug',
- to: '_list/doc/docs_by_slug',
- query: {
- startkey: [':site', 'video', ':slug'],
- endkey: [':site', 'video', ':slug', {}],
- include_docs: 'true'
- }
- }
- # Profile content page
- {
- from: '/render/:site/profile/:slug',
- to: '_list/doc/docs_by_slug',
- query: {
- startkey: [':site', 'profile', ':slug'],
- endkey: [':site', 'profile', ':slug', {}],
- include_docs: 'true'
- }
- }
- # All docs list for site sorted by `updated_at`
- {
- from: '/render/:site/docs',
- to: '_list/docs/docs_by_date',
- query: {
- startkey: [':site', {}],
- endkey: [':site'],
- descending: 'true',
- include_docs: 'true'
- }
- }
- # RSS Feed of all docs sorted by `published_at`
- {
- from: '/render/:site/feed',
- to: '_list/rssfeed/docs_for_feeds',
- query: {
- startkey: [':site', {}],
- endkey: [':site'],
- descending: 'true',
- include_docs: 'true',
- limit: '11'
- }
- }
- # Sitemap.xml file of all docs sorted by `updated_at`
- {
- from: '/render/:site/sitemap.xml',
- to: '_list/sitemap/docs_for_sitemaps',
- query: {
- startkey: [':site', {}, {}],
- endkey: [':site', null],
- descending: 'true'
- }
- }
- # File attachments paths
- { from: '/file/:id/:filename', to: '../../:id/:filename' }
- { from: '/render/:site/file/:id/:filename', to: '../../:id/:filename' }
-
- # Redirected old URLs using a pattern
- movedPattern '/render/:site/posts/:id/:slug', '/:type/:slug'
- # Redirect some direct paths
- # moved '/render/:site/some-old-path', '/some-new-path'
- # `redirect` type - from a slug to a URL
- # doc id must be like `r/www.example.com/some-path`
- {
- from: '/render/:site/*',
- to: '_show/redirect/r/:site/*'
- }
- # 404 not found
- { from: '/not-found', to: '_show/not_found' }
- # Catch all route
- { from: '*', to: '_show/not_found' }
- ]
|