diff --git a/src/MyWebLog/MyWebLog.fsproj b/src/MyWebLog/MyWebLog.fsproj index cfb5be8..8bff1fa 100644 --- a/src/MyWebLog/MyWebLog.fsproj +++ b/src/MyWebLog/MyWebLog.fsproj @@ -26,6 +26,7 @@ + diff --git a/src/MyWebLog/Program.fs b/src/MyWebLog/Program.fs index 5df9b59..33abe8f 100644 --- a/src/MyWebLog/Program.fs +++ b/src/MyWebLog/Program.fs @@ -58,6 +58,7 @@ open Giraffe.EndpointRouting open Microsoft.AspNetCore.Authentication.Cookies open Microsoft.AspNetCore.Builder open Microsoft.AspNetCore.HttpOverrides +open NeoSmart.Caching.Sqlite open RethinkDB.DistributedCache [] @@ -97,17 +98,16 @@ let rec main args = |> ignore | :? SQLiteData -> // ADO.NET connections are designed to work as per-request instantiation + let cfg = sp.GetRequiredService () builder.Services.AddScoped (fun sp -> - let cfg = sp.GetRequiredService () let conn = new SqliteConnection (cfg.GetConnectionString "SQLite") SQLiteData.setUpConnection conn |> Async.AwaitTask |> Async.RunSynchronously conn) |> ignore builder.Services.AddScoped () |> ignore - let log = sp.GetRequiredService () - let logger = log.CreateLogger "MyWebLog.StartUp" - logger.LogWarning "Session caching is not yet implemented via SQLite; using memory cache for sessions" - builder.Services.AddDistributedMemoryCache () |> ignore + // Use SQLite for caching as well + let cachePath = defaultArg (Option.ofObj (cfg.GetConnectionString "SQLiteCachePath")) "./session.db" + builder.Services.AddSqliteCache (fun o -> o.CachePath <- cachePath) |> ignore | _ -> () | None -> invalidOp "There is no data configuration present; please add a RethinkDB section or LiteDB connection string" diff --git a/src/default-theme/index.liquid b/src/default-theme/index.liquid index a34aec2..3c71f6e 100644 --- a/src/default-theme/index.liquid +++ b/src/default-theme/index.liquid @@ -3,56 +3,50 @@ {% endif %}
{% for post in model.posts %} -
-
-
-

- - {{ post.title }} - -

+
+

+ + {{ post.title }} + +

+

+ Published on {{ post.published_on | date: "MMMM d, yyyy" }} + at {{ post.published_on | date: "h:mmtt" | downcase }} + by {{ model.authors | value: post.author_id }} +

+ {{ post.text }} + {%- assign category_count = post.category_ids | size -%} + {%- assign tag_count = post.tags | size -%} + {% if category_count > 0 or tag_count > 0 %} +

- Published on {{ post.published_on | date: "MMMM d, yyyy" }} - at {{ post.published_on | date: "h:mmtt" | downcase }} - by {{ model.authors | value: post.author_id }} + {%- if category_count > 0 -%} + Categorized under: + {% for cat in post.category_ids -%} + {%- assign this_cat = categories | where: "id", cat | first -%} + {{ this_cat.name }}{% unless forloop.last %}, {% endunless %} + {%- assign cat_names = this_cat.name | concat: cat_names -%} + {%- endfor -%} + {%- assign cat_names = "" -%} +
+ {% endif -%} + {%- if tag_count > 0 %} + Tagged: {{ post.tags | join: ", " }} + {% endif -%}

- {{ post.text }} - {%- assign category_count = post.category_ids | size -%} - {%- assign tag_count = post.tags | size -%} - {% if category_count > 0 or tag_count > 0 %} -
-

- {%- if category_count > 0 -%} - Categorized under: {{ cat_names | reverse | join: ", " }} - {%- for cat in post.category_ids -%} - {%- assign this_cat = categories | where: "id", cat | first -%} - {{ this_cat.name }}, - {%- assign cat_names = this_cat.name | concat: cat_names -%} - {%- endfor -%} - {%- assign cat_names = "" -%} -
- {% endif -%} - {%- if tag_count > 0 %} - Tagged: {{ post.tags | join: ", " }} - {% endif -%} -

-
- {% endif %} -
-
-
-
- {% endfor %} - +
+ + {% endfor %}
+ diff --git a/src/default-theme/layout.liquid b/src/default-theme/layout.liquid index 9a56e9f..01aea34 100644 --- a/src/default-theme/layout.liquid +++ b/src/default-theme/layout.liquid @@ -21,13 +21,12 @@ {% if web_log.subtitle -%} {{ web_log.subtitle.value | escape }} {%- endif %} - {% if page_list -%} - - {%- endif %} + {% user_links %} @@ -53,7 +52,7 @@

- myWebLog + myWebLog