Discussion:
[hakyll] Renaming a file
c***@gmail.com
2016-12-30 23:14:46 UTC
Permalink
Is it possible to rename files matching a pattern? For instance, the
following properly converts all markdown files to html files recursively
from the v/ directory -

match "v/**" $ do
route $ setExtension ".html"
compile $ pandocCompiler
= loadAndApplyTemplate "templates/doc.html" docCtx
= loadAndApplyTemplate "templates/default.html" docCtx
= processUrls
But I'd like to rename any files named "README.md" as "index.html". What's
the best way to go about this?

I'll be hanging out on #freenode as crobbins, so feel free to ping me
there, thanks!
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kyle Marek-Spartz
2016-12-31 14:54:22 UTC
Permalink
https://hackage.haskell.org/package/hakyll-4.8.3.2/docs/Hakyll-Core-Routes.html#v:composeRoutes

Where you currently have setExtension in your routes, you can do something like this:

From:
match "*.md" $ do
route $ (gsubRoute "README" (const "index")) `composeRoutes` (setExtension "html")
....
To:

match "*.md" $ do
route $ (setExtension "html"
....



–
Kyle Marek-Spartz
Is it possible to rename files matching a pattern? For instance, the following properly converts all markdown files to html files recursively from the v/ directory -
match "v/**" $ do
route $ setExtension ".html"
compile $ pandocCompiler
= loadAndApplyTemplate "templates/doc.html" docCtx
= loadAndApplyTemplate "templates/default.html" docCtx
= processUrls
But I'd like to rename any files named "README.md" as "index.html". What's the best way to go about this?
I'll be hanging out on #freenode as crobbins, so feel free to ping me there, thanks!
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c***@gmail.com
2016-12-31 16:29:03 UTC
Permalink
Great, thanks! I had figured something like this out, but then it messed up
the relative links, so I abandoned it and just set up a redirect from
**/index.html to **/README/
Post by Kyle Marek-Spartz
https://hackage.haskell.org/package/hakyll-4.8.3.2/docs/Hakyll-Core-Routes.html#v:composeRoutes
match "*.md" $ do
route $ (gsubRoute "README" (const "index")) `composeRoutes` (setExtension "html")
....
match "*.md" $ do
route $ (setExtension "html"
....
–
Kyle Marek-Spartz
Is it possible to rename files matching a pattern? For instance, the
following properly converts all markdown files to html files recursively
from the v/ directory -
match "v/**" $ do
route $ setExtension ".html"
compile $ pandocCompiler
= loadAndApplyTemplate "templates/doc.html" docCtx
= loadAndApplyTemplate "templates/default.html" docCtx
= processUrls
But I'd like to rename any files named "README.md" as "index.html". What's
the best way to go about this?
I'll be hanging out on #freenode as crobbins, so feel free to ping me there, thanks!
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...