~fgaz/gemini-textboard

eff298b42087b79b5ff1b0cf51c1ed7a76f3d3ab — Francesco Gazzetta 2 years ago 805462a
Add robots.txt
1 files changed, 8 insertions(+), 0 deletions(-)

M app/Main.hs
M app/Main.hs => app/Main.hs +8 -0
@@ 166,6 166,7 @@ app = asum
  , dir "thread" $ capture $ \threadId -> end $ threadHandler threadId
  , dir "thread" $ capture $ \threadId -> dir "post" $ end $ threadPostRedirectHandler threadId
  , dir "p" $ capture $ \nonce -> input "Write your post" $ \post -> end $ postHandler nonce post
  , dir "robots.txt" $ end robotsTxt
  ]

homepageHandler :: App Response


@@ 235,6 236,13 @@ postHandler nonce content = do
    Reply threadId -> insertReply threadId content $> threadId
  pure $ redirect $ fromJust $ parseRelativeReference $ "/thread/" <> show threadId

robotsTxt :: App Response
robotsTxt = pure $ okGemini $ encodeUtf8
  "User-agent: *\n\
  \# Do not crawl submission pages\n\
  \Disallow: /post/\n\
  \Disallow: /p/"

-- Utils
--------