Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build a site without archive #953

Closed
qaristote opened this issue Sep 19, 2022 · 4 comments
Closed

Cannot build a site without archive #953

qaristote opened this issue Sep 19, 2022 · 4 comments
Labels

Comments

@qaristote
Copy link

qaristote commented Sep 19, 2022

I'm trying out Hakyll and want to build a single webpage with no blog posts nor archives. I thus deleted every instance of these that appears in the initial site:

$ ls
css  images  index.html  my-site.cabal  site.hs  templates

$ ls templates
default.html

$ cat index.html
---
title: Home
---

<h2>Welcome</h2>

<img src="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/images/haskell-logo.png" style="float: right; margin: 10px;" />

<p>Welcome to my blog!</p>

<p>I've reproduced a list of recent posts here for your reading pleasure:</p>

$ cat site.hs
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
import           Data.Monoid (mappend)
import           Hakyll


--------------------------------------------------------------------------------
main :: IO ()
main = hakyll $ do
    match "images/*" $ do
        route   idRoute
        compile copyFileCompiler

    match "css/*" $ do
        route   idRoute
        compile compressCssCompiler

    match "index.html" $ do
        route idRoute
        compile copyFileCompiler
--------------------------------------------------------------------------------

$ cat templates/default.html
...
        <header>
            <div class="logo">
                <a href="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/">My Hakyll Blog</a>
            </div>
            <nav>
                <a href="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/">Home</a>
            </nav>
        </header>
...

But somehow Hakyll still insists on building archive.html:

$ cabal build
...
$ site build -v
Initialising...
  Creating store...
  Creating provider...
  Running rules...
Checking for out-of-date items
  [DEBUG] archive.html is out-of-date because it is new
  [DEBUG] css/default.css is out-of-date because it is new
  [DEBUG] images/haskell-logo.png is out-of-date because it is new
  [DEBUG] index.html is out-of-date because it is new
  [DEBUG] templates/default.html is out-of-date because it is new
Compiling
  [DEBUG] Processing archive.html
  [DEBUG] Hakyll.Core.Compiler.Internal: Adding dependency: PatternDependency (Glob [Literal "posts/",Capture,Literal ""]) (fromList [])
  [DEBUG] Processing css/default.css
  [DEBUG] Processing images/haskell-logo.png
  updated images/haskell-logo.png
  [DEBUG] Processing index.html
  [DEBUG] Hakyll.Core.Compiler.Internal: Adding dependency: PatternDependency (Glob [Literal "posts/",Capture,Literal ""]) (fromList [])
  [DEBUG] Processing templates/default.html
  updated css/default.css
  cached  templates/default.html
  [DEBUG] Routed to _site/images/haskell-logo.png
  [DEBUG] Routed to _site/css/default.css
  [DEBUG] Processing archive.html
  [DEBUG] Processing index.html
  [DEBUG] Hakyll.Core.Compiler.Internal: Adding dependency: IdentifierDependency templates/default.html
  [DEBUG] Compiler requirement found for: index.html: templates/default.html (snapshot _final)
  [ERROR] Hakyll.Core.Compiler.Require.load: templates/archive.html (snapshot _final) was not found in the cache, the cache might be corrupted or the item you are referring to might not exist

Why is that ? What I am supposed to do if I don't want to build a blog ?

@jaspervdj
Copy link
Owner

This seems weird -- maybe cabal build did not put the output in ./site? Could you try again using e.g. cabal run site?

@qaristote
Copy link
Author

Yes that works thank you ! Note that site build still doesn't work even after a successful cabal run site build though.

@Minoru
Copy link
Collaborator

Minoru commented Oct 8, 2022

@qaristote You have to re-run cabal new-install every time you change the Haskell code. If you don't do that, invocations of site build would run an old version of the binary. You can do cabal new-install && site build if you want, but cabal run site build achieves pretty much the same result without installing the binary into ~/.cabal/bin.

@Minoru Minoru added the question label Oct 8, 2022
@qaristote
Copy link
Author

Oh ok I get it now, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants