diff --git a/Hakyll/Web/Agda.hs b/Hakyll/Web/Agda.hs
--- a/Hakyll/Web/Agda.hs
+++ b/Hakyll/Web/Agda.hs
@@ -36,12 +36,14 @@
 import           System.Exit (exitFailure)
 import           System.FilePath (dropFileName, splitExtension)
 import           Text.Pandoc (readMarkdown, ReaderOptions, WriterOptions)
+import qualified Text.Pandoc as Pandoc
 import           Text.XHtml.Strict
+import qualified Data.Text as T
 
 checkFile :: AbsolutePath -> TCM TopLevelModuleName
 checkFile file = do
     TCM.resetState
-    toTopLevelModuleName . TCM.iModuleName . fst <$> Imp.typeCheckMain file
+    toTopLevelModuleName . TCM.iModuleName . fst <$> Imp.typeCheckMain file Imp.TypeCheck
 
 getModule :: TopLevelModuleName -> TCM (HighlightingInfo, String)
 getModule m = do
@@ -127,9 +129,9 @@
     -- Notes are not included.
     noteClasses _ = []
 
-    link (m', pos') = if m == m'
-                      then Just [href ("#" ++ show pos')]
-                      else Nothing
+    link defSite = if defSiteModule defSite == m
+      then Just [href ("#" ++ show (defSitePos defSite))]
+      else Nothing
 
 toMarkdown :: String
            -> TopLevelModuleName -> [Either String [(Integer, String, Aspects)]]
@@ -188,8 +190,8 @@
              abfp <- canonicalizePath fp
              setCurrentDirectory (dropFileName abfp)
              s <- markdownAgda aopt "Agda" abfp
-             let i' = i {itemBody = s}
-             case traverse (readMarkdown ropt) i' of
+             let i' = i {itemBody = T.pack s}
+             case Pandoc.runPure (traverse (readMarkdown ropt) i') of
                Left err -> fail $ "pandocAgdaCompilerWith: Pandoc failed with error " ++ show err
                Right i'' -> return $ writePandocWith wopt i''
       else pandocCompilerWith ropt wopt
diff --git a/hakyll-agda.cabal b/hakyll-agda.cabal
--- a/hakyll-agda.cabal
+++ b/hakyll-agda.cabal
@@ -1,15 +1,14 @@
 Cabal-version:      >= 1.6
 Name:               hakyll-agda
-Version:            0.1.10.1
+Version:            0.1.11
 Author:             Francesco Mazzoli (f@mazzo.li)
 Maintainer:         Francesco Mazzoli (f@mazzo.li)
 Build-Type:         Simple
 License:            BSD3
 License-File:       LICENSE
-Build-Type:         Simple
 Category:           Web
 Synopsis:           Wrapper to integrate literate Agda files with Hakyll
-Tested-With:        GHC==7.8.3
+Tested-With:        GHC==8.4.4
 Homepage:           https://github.com/bitonic/hakyll-agda
 Bug-Reports:        https://github.com/bitonic/hakyll-agda/issues
 Description:        Simple module useful to generate blog posts from literate
@@ -22,14 +21,15 @@
 
 Library
     Build-Depends:    base         >= 3 && < 5
-                    , Agda         == 2.4.2.3
+                    , Agda         == 2.5.*
                     , containers
                     , directory
                     , filepath
-                    , hakyll       >= 4.7.2.0 && < 4.9
+                    , hakyll       >= 4.7.2.0
                     , mtl
                     , pandoc
                     , transformers
                     , xhtml
+                    , text
     GHC-Options:      -Wall
     Exposed-Modules:  Hakyll.Web.Agda
