我看到創建函數需要一個標識符列表。Hakyll網站的根源是什麼?
ghci λ> :t create
create :: [Identifier] -> Rules() -> Rules()
我應該使用什麼樣的標識符列表來匹配網站的根?例如,我只想製作一個不帶「/ posts」或「/ archives」或任何其他域部分的「www.example.com」上出現的單個html頁面。
我試過幾個:
create "/" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "/*" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "." $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "./" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "/." $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create Nothing $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
我得到這樣的錯誤:
site.hs:24:12: error:
• Couldn't match type ‘Identifier’ with ‘Char’
arising from the literal ‘""’
• In the first argument of ‘create’, namely ‘""’
In the expression: create ""
In a stmt of a 'do' block:
create ""
$ do { route idRoute;
compile
$ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls }
Failed, modules loaded: none.
Loaded GHCi configuration from /tmp/ghci29841/ghci-script
我不能說:i Identifier
或reading documentation或reading the source code使得這再清楚不過對我來說:
ghci λ> :i Identifier
data Identifier
= Hakyll.Core.Identifier.Identifier {identifierVersion :: Maybe
String,
Hakyll.Core.Identifier.identifierPath :: String}
-- Defined in ‘Hakyll.Core.Identifier’
instance Eq Identifier -- Defined in ‘Hakyll.Core.Identifier’
instance Ord Identifier -- Defined in ‘Hakyll.Core.Identifier’
instance Show Identifier -- Defined in ‘Hakyll.Core.Identifier’
我應該使用什麼魔法咒語,以創建將出現「/」 HTML和我應該怎麼已經調查這更好使它那麼神祕?
這取決於您的服務器配置方式。當有人試圖訪問www.example.com時,通常「www.example.com/index.html」將成爲着陸頁。請參閱[此行](https://github.com/gallais/gallais.github.io/blob/source/src/site.hs#L68)。 – gallais
您是否嘗試過'fromFilePath「./」'? – arrowd
@gallais,據我所知,使用index.html生成一個默認文件服務器,似乎不尊重我提供的任何模板或內容。 – Mittenchops