From 61fece254c2d87943abe77a0c1f6e77ecabb3a7a Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Sat, 5 Aug 2017 10:32:11 -0500 Subject: [PATCH] Add a page describing advertising --- content/templates/advertising.html | 62 ++++++++++++++++++++++++++++++ executables/haskell-weekly.hs | 19 ++++++++- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 content/templates/advertising.html diff --git a/content/templates/advertising.html b/content/templates/advertising.html new file mode 100644 index 0000000..02b41d8 --- /dev/null +++ b/content/templates/advertising.html @@ -0,0 +1,62 @@ +

Advertising

+ +

+ You can advertise with Haskell Weekly by purchasing a sponsored link. + Sponsored links are similar to featured links except that they say "(ad)" after the title. + Here's an example of how they look: +

+ + + +

+ Each sponsored link has three required pieces: +

+ +
    +
  1. +

    + URL: + This can be whatever you want. + We recommend using a URL that will allow you to track engagement. + For example, Google's link shortener provides analytics data. +

    +
  2. + +
  3. +

    + Title: + This is up to 80 characters of plain text. +

    +
  4. + +
  5. +

    + Copy: + This is up to 300 characters of plain text. + It can include basic Markdown formatting. +

    +
  6. +
+ +

+ Sponsored links cost US$$60 per issue. + Payment is accepted through Square. + If you are interesting in advertising with Haskell Weekly, + please reach out to info@haskellweekly.news. +

diff --git a/executables/haskell-weekly.hs b/executables/haskell-weekly.hs index d1ea160..d64461d 100644 --- a/executables/haskell-weekly.hs +++ b/executables/haskell-weekly.hs @@ -51,7 +51,8 @@ main = do let context :: Context context = - [ ("baseUrl", "https://haskellweekly.news") + [ ("", "$") + , ("baseUrl", "https://haskellweekly.news") , ("form", form) , ("logo", logo) , ("script", script) @@ -59,6 +60,7 @@ main = do ] -- Read templates. + advertisingTemplate <- readFileAt [input, "templates", "advertising.html"] atomEntryTemplate <- readFileAt [input, "templates", "atom-entry.xml"] atomTemplate <- readFileAt [input, "templates", "atom.xml"] baseTemplate <- readFileAt [input, "templates", "base.html"] @@ -97,6 +99,11 @@ main = do contents <- renderRss rssTemplate rssItemTemplate context recentIssues writeFileAt [output, "haskell-weekly.rss"] contents + -- Create advertising page. + do + contents <- renderAdvertising baseTemplate advertisingTemplate context + writeFileAt [output, "advertising.html"] contents + -- Create home page. do contents <- renderIndex baseTemplate indexTemplate snippetTemplate context issues @@ -193,6 +200,16 @@ summary = -- Rendering helpers +renderAdvertising :: Monad m => Text -> Text -> Context -> m Text +renderAdvertising template advertisingTemplate context = do + body <- renderTemplate advertisingTemplate context + renderTemplate template (context <> + [ ("body", body) + , ("summary", "Information about advertising with Haskell Weekly.") + , ("title", pageTitle (Just "Advertising")) + , ("url", "/advertising.html") + ]) + renderAtom :: Monad m => Text -> Text -> Context -> [Issue] -> m Text renderAtom template entryTemplate context issues = do entries <- mapM (renderAtomEntry entryTemplate context) issues