diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 33b8aa76a..c0cc815d4 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -276,6 +276,9 @@ pageTemplate = unlines
  , "$endfor$"
  , "$else$"
  , "<h1>$title$</h1>"
+ , "$if(toc)$"
+ , "$toc$"
+ , "$endif$"
  , "$body$"
  , "$endif$"
  , "</body>"