diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c79f7..b962c20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index c161fe9..054da50 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bore.cabal b/bore.cabal index fe4295e..830e35e 100644 --- a/bore.cabal +++ b/bore.cabal @@ -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 diff --git a/src/Bore/Phlog.hs b/src/Bore/Phlog.hs index 0f2fe60..7abd98d 100644 --- a/src/Bore/Phlog.hs +++ b/src/Bore/Phlog.hs @@ -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. @@ -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. @@ -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.