Skip to content

Commit

Permalink
phlog entry order and format
Browse files Browse the repository at this point in the history
  • Loading branch information
someodd committed Oct 23, 2024
1 parent dec85ed commit a36dbb4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased]

Phlogging!

### Changed

* Phlog post order on menu indexes is now descending (older as you go on)
* Phlog post entries on menu indexes reformatted

## [0.14.0.0] - 2024-10-22

### Fixed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Here are some features, but I recommend checking out `example/` for an example g
* Bundled with a Gopher Protocol server
* FrontMatter support, you can choose if something is to become a gophermap/menu (you can even use the [.gophermap standard](https://sternenseemann.github.io/spacecookie/spacecookie.gophermap.5.html) for writing those!)
* Phlogging (blogging) support, with a generated Atom feed and tag and main indexes
* Search support, search all your `.txt` files with a file ranking algorithm

## Quickstart

Expand Down
2 changes: 1 addition & 1 deletion bore.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 2.2
-- see: https://github.com/sol/hpack

name: bore
version: 0.12.0.0
version: 0.14.0.0
synopsis: Build gopherholes.
description: Static site builder, but for gopherholes. Manage phlogs with tags, use the Markdown renderer and Mustache templating system.
category: Network
Expand Down
10 changes: 5 additions & 5 deletions src/Bore/Phlog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Data.Maybe (fromMaybe, listToMaybe)
import qualified Data.Text.IO as TextIO
import System.FilePath ((</>), takeFileName, takeDirectory)
import System.Directory (createDirectoryIfMissing)
import Data.Ord (Down(..))

{- | Determines if the frontmatter indicates a phlog post.
Expand Down Expand Up @@ -72,12 +73,11 @@ interpretDate text =
defaultNullDate :: Text.Text
defaultNullDate = "unknown"

{- | Sort phlog posts by date.
-}
-- | Sort phlog posts by date in descending (older as you go down/newest first) order.
sortPhlogMetaByDate :: [PhlogMeta] -> [PhlogMeta]
sortPhlogMetaByDate =
sortOn (\(_, _, frontMatter) -> interpretDate (fromMaybe defaultNullDate (frontMatter.date)))
sortOn (Down . (\(_, _, frontMatter) -> interpretDate (fromMaybe defaultNullDate (frontMatter.date))))


{- | Extract the year from the frontmatter's date.
Expand Down Expand Up @@ -124,7 +124,7 @@ toPhlogLabel (_, relativePath, frontMatter) =
date = fromMaybe "No date" frontMatter.date
tags = Text.intercalate ", " (fromMaybe ["No tags"] (frontMatter.tags))
in
title <> " - " <> date <> " - " <> tags <> " - " <> Text.pack relativePath
date <> " - " <> title <> " - " <> tags <> " - " <> Text.pack relativePath

{- | Create a gopher link to a phlog post.
Expand Down

0 comments on commit a36dbb4

Please sign in to comment.