add sitemap.xml
This commit is contained in:
parent
d44978d713
commit
5c11de8399
3 changed files with 30 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
User-agent: *
|
User-agent: *
|
||||||
|
Sitemap: https://nek0.eu/sitemap.xml
|
||||||
Disallow: /imprint.html
|
Disallow: /imprint.html
|
||||||
Disallow: /contact.html
|
Disallow: /contact.html
|
||||||
|
|
18
src/Main.hs
18
src/Main.hs
|
@ -138,6 +138,24 @@ main =
|
||||||
>>= fmap (take 10) . recentFirst
|
>>= fmap (take 10) . recentFirst
|
||||||
>>= renderRss feedConf feedCtx
|
>>= renderRss feedConf feedCtx
|
||||||
|
|
||||||
|
create ["sitemap.xml"] $ do
|
||||||
|
route idRoute
|
||||||
|
compile $ do
|
||||||
|
rposts <- loadAll "site/**/*.md"
|
||||||
|
rsites <- loadAll "site/*.md"
|
||||||
|
-- rtxts <- loadAll "site/*.txt"
|
||||||
|
-- rascs <- loadAll "site/*.asc"
|
||||||
|
let sites = return (rposts ++ rsites)
|
||||||
|
let sitemapCtx = mconcat
|
||||||
|
[ listField "entries"
|
||||||
|
(postCtx tags <> constField "host" "https://nek0.eu/")
|
||||||
|
sites
|
||||||
|
, constField "host" "https://nek0.eu/"
|
||||||
|
, defaultContext
|
||||||
|
]
|
||||||
|
makeItem ""
|
||||||
|
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
sortIdentifiersByDate :: [Identifier] -> [Identifier]
|
sortIdentifiersByDate :: [Identifier] -> [Identifier]
|
||||||
|
|
11
templates/sitemap.xml
Normal file
11
templates/sitemap.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
$for(entries)$
|
||||||
|
<url>
|
||||||
|
<loc>$host$$url$</loc>
|
||||||
|
<changefreq>monthly</changefreq>
|
||||||
|
$if(lastmod)$<lastmod>$lastmod$</lastmod>$endif$
|
||||||
|
<priority>0.8</priority>
|
||||||
|
</url>
|
||||||
|
$endfor$
|
||||||
|
</urlset>
|
Loading…
Reference in a new issue