Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ For detailed information about configuration, theming, and deployment, check out
article1.dj.meta.json
article2.dj
article2.dj.meta.json
./cynthia-mini.toml
./cynthia.toml
```

## Contributing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ fn compute_menus(content: List(contenttypes.Content), model: Model) {
content
|> list.filter_map(fn(alls) {
case alls.data {
contenttypes.PageData(soms) -> Ok(soms)
contenttypes.PageData(soms, _) -> Ok(soms)
_ -> Error(Nil)
}
})
Expand All @@ -595,7 +595,7 @@ fn add_each_menu(
let hits: List(model_type.MenuItem) =
list.filter_map(items, fn(item) -> Result(model_type.MenuItem, Nil) {
case item.data {
contenttypes.PageData(m) -> {
contenttypes.PageData(m, _) -> {
case m |> list.contains(current_menu) {
True -> {
Ok(model_type.MenuItem(name: item.title, to: item.permalink))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ pub type ContentData {
PageData(
/// In which menus this page should appear
in_menus: List(Int),
/// Hide the block with title and description for a page.
hide_meta_block: Bool,
)
}

Expand All @@ -131,7 +133,12 @@ pub fn content_data_decoder() -> decode.Decoder(ContentData) {
}
"page_data" -> {
use in_menus <- decode.field("in_menus", decode.list(decode.int))
decode.success(PageData(in_menus:))
use hide_meta_block <- decode.optional_field(
"hide_meta",
False,
decode.bool,
)
decode.success(PageData(in_menus:, hide_meta_block:))
}
_ ->
decode.failure(
Expand All @@ -151,10 +158,11 @@ pub fn encode_content_data(content_data: ContentData) -> json.Json {
#("category", json.string(category)),
#("tags", json.array(tags, json.string)),
])
PageData(in_menus:) ->
PageData(in_menus:, hide_meta_block:) ->
json.object([
#("type", json.string("page_data")),
#("in_menus", json.array(in_menus, json.int)),
#("hide_meta", json.bool(hide_meta_block)),
])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn render_content(
let assert Ok(def) = paints.get_sytheme(model)

let #(into, output, variables) = case content.data {
contenttypes.PageData(_) -> {
contenttypes.PageData(_, hide_metadata_block) -> {
let mold = case content.layout {
"default" | "theme" | "" -> molds.into(def.layout, "page", model)
layout -> molds.into(layout, "page", model)
Expand All @@ -39,6 +39,10 @@ pub fn render_content(
|> dict.insert("title", content.title |> dynamic.from)
|> dict.insert("description_html", description |> dynamic.from)
|> dict.insert("description", content.description |> dynamic.from)
|> dict.insert(
"hide_metadata_block",
hide_metadata_block |> dynamic.from,
)
#(mold, parse_html(content.inner_plain, content.filename), variables)
}
contenttypes.PostData(category:, date_published:, date_updated:, tags:) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ fn cindy_common(
|> result.unwrap(dynamic.from(option.None))
|> decode.run(decode.string)
}
let hide_metadata_block =
decode.run(
result.unwrap(
dict.get(variables, "hide_metadata_block"),
dynamic.from(False),
),
decode.bool,
)
|> result.unwrap(False)
let hide_metadata_block_classonly = case hide_metadata_block {
True -> " hidden"
False -> ""
}
html.div([attribute.id("content"), attribute.class("w-full mb-2")], [
html.span([], [
html.div(
Expand Down Expand Up @@ -344,7 +357,8 @@ fn cindy_common(
html.div(
[
attribute.class(
"col-span-5 row-span-4 row-start-9 md:row-span-8 md:col-span[] md:col-start-1 md:row-start-3 min-h-full bg-base-200 rounded-br-2xl overflow-auto w-full md:w-fit md:max-w-[20VW] p-4 md:p-3 break-words shadow-inner",
"col-span-5 row-span-4 row-start-9 md:row-span-8 md:col-start-1 md:row-start-3 min-h-full bg-base-200 rounded-br-2xl overflow-auto w-full md:w-fit md:max-w-[20VW] p-4 md:p-3 break-words shadow-inner"
<> hide_metadata_block_classonly,
),
],
[post_meta],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn page_layout(
),
decode.string,
)

html.div([attribute.class("break-words")], [
html.h3(
[
Expand Down Expand Up @@ -200,8 +201,22 @@ fn cindy_common(
|> result.unwrap(dynamic.from(option.None))
|> decode.run(decode.string)
}
let hide_metadata_block =
decode.run(
result.unwrap(
dict.get(variables, "hide_metadata_block"),
dynamic.from(False),
),
decode.bool,
)
|> result.unwrap(False)
let hide_metadata_block_classonly = case hide_metadata_block {
True -> " hidden"
False -> ""
}
html.div([attribute.id("content"), attribute.class("w-full mb-2")], [
html.span([], [
// element.text(variables |> string.inspect),
html.div(
[
attribute.class(
Expand Down Expand Up @@ -340,7 +355,8 @@ fn cindy_common(
html.div(
[
attribute.class(
"col-span-5 row-span-4 row-start-9 md:row-span-8 md:col-span[] md:col-start-1 md:row-start-2 min-h-full bg-base-200 rounded-br-2xl overflow-auto w-full md:w-fit md:max-w-[20VW] p-4 md:p-3 break-words shadow-inner",
"col-span-5 row-span-4 row-start-9 md:row-span-8 md:col-start-1 md:row-start-2 min-h-full bg-base-200 rounded-br-2xl overflow-auto w-full md:w-fit md:max-w-[20VW] p-4 md:p-3 break-words shadow-inner"
<> hide_metadata_block_classonly,
),
],
[post_meta],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn main(model: Model) -> Element(Msg) {
layout: "theme",
permalink: "404",
inner_plain: "# 404!\n\nThe page you are looking for does not exist.",
data: contenttypes.PageData([]),
data: contenttypes.PageData([], True),
)
})
let content = case model.path {
Expand All @@ -57,7 +57,7 @@ pub fn main(model: Model) -> Element(Msg) {
layout: "default",
permalink: model.path,
filename: "postlist.html",
data: contenttypes.PageData([]),
data: contenttypes.PageData([], False),
inner_plain: postlistloader.postlist_by_category(
model,
category,
Expand All @@ -78,7 +78,7 @@ pub fn main(model: Model) -> Element(Msg) {
layout: "default",
permalink: model.path,
filename: "postlist.html",
data: contenttypes.PageData([]),
data: contenttypes.PageData([], True),
inner_plain: postlistloader.postlist_by_tag(model, tag)
|> element.to_string,
)
Expand All @@ -93,7 +93,7 @@ pub fn main(model: Model) -> Element(Msg) {
layout: "default",
permalink: model.path,
filename: "postlist.html",
data: contenttypes.PageData([]),
data: contenttypes.PageData([], False),
inner_plain: postlistloader.postlist_by_search_term(
model,
search_term,
Expand All @@ -110,7 +110,7 @@ pub fn main(model: Model) -> Element(Msg) {
layout: "default",
permalink: model.path,
filename: "postlist.html",
data: contenttypes.PageData([]),
data: contenttypes.PageData([], False),
inner_plain: postlistloader.postlist_all(model)
|> element.to_string,
)
Expand Down
12 changes: 6 additions & 6 deletions cynthia_websites_mini_server/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages = [
{ name = "birl", version = "1.8.0", build_tools = ["gleam"], requirements = ["gleam_regexp", "gleam_stdlib", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "2AC7BA26F998E3DFADDB657148BD5DDFE966958AD4D6D6957DD0D22E5B56C400" },
{ name = "bungibindies", version = "1.2.0-rc", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], otp_app = "bungibindies", source = "hex", outer_checksum = "C1A4DD5D0BE282E4A6F007ECE3FE1477E38CFDF1B6043A5ABAB63C53443AC473" },
{ name = "conversation", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "conversation", source = "hex", outer_checksum = "103DF47463B8432AB713D6643DC17244B9C82E2B172A343150805129FE584A2F" },
{ name = "cynthia_websites_mini_client", version = "1.2.0-rc", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_fetch", "gleam_http", "gleam_javascript", "gleam_json", "gleam_stdlib", "gleam_time", "houdini", "jot", "lustre", "modem", "odysseus", "plinth", "rsvp"], source = "local", path = "../cynthia_websites_mini_client" },
{ name = "cynthia_websites_mini_client", version = "1.2.0-rc2", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_fetch", "gleam_http", "gleam_javascript", "gleam_json", "gleam_stdlib", "gleam_time", "houdini", "jot", "lustre", "modem", "odysseus", "plinth", "rsvp"], source = "local", path = "../cynthia_websites_mini_client" },
{ name = "edit_distance", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "edit_distance", source = "hex", outer_checksum = "A1E485C69A70210223E46E63985FA1008B8B2DDA9848B7897469171B29020C05" },
{ name = "envoy", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "95FD059345AA982E89A0B6E2A3BF1CF43E17A7048DCD85B5B65D3B9E4E39D359" },
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
Expand All @@ -18,20 +18,20 @@ packages = [
{ name = "gleam_erlang", version = "0.34.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "0C38F2A128BAA0CEF17C3000BD2097EB80634E239CE31A86400C4416A5D0FDCC" },
{ name = "gleam_fetch", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "2CBF9F2E1C71AEBBFB13A9D5720CD8DB4263EB02FE60C5A7A1C6E17B0151C20C" },
{ name = "gleam_http", version = "3.7.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "8A70D2F70BB7CFEB5DF048A2183FFBA91AF6D4CF5798504841744A16999E33D2" },
{ name = "gleam_httpc", version = "4.2.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "224BF35B2091502921D1623F35E6FA52815B75D99D18AEFB9DAEA0B8AEADD7A1" },
{ name = "gleam_httpc", version = "4.1.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "C670EBD46FC1472AD5F1F74F1D3938D1D0AC1C7531895ED1D4DDCB6F07279F43" },
{ name = "gleam_javascript", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "EF6C77A506F026C6FB37941889477CD5E4234FCD4337FF0E9384E297CB8F97EB" },
{ name = "gleam_json", version = "2.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "C55C5C2B318533A8072D221C5E06E5A75711C129E420DD1CE463342106012E5D" },
{ name = "gleam_otp", version = "0.16.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "50DA1539FC8E8FA09924EB36A67A2BBB0AD6B27BCDED5A7EF627057CF69D035E" },
{ name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" },
{ name = "gleam_stdlib", version = "0.59.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "F8FEE9B35797301994B81AF75508CF87C328FE1585558B0FFD188DC2B32EAA95" },
{ name = "gleam_time", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "F9AB61CE910F3071B136E1C8E214A46C406734F710D3AF75C99B00DA785902A2" },
{ name = "gleam_time", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "0DF3834D20193F0A38D0EB21F0A78D48F2EC276C285969131B86DF8D4EF9E762" },
{ name = "gleam_yielder", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_yielder", source = "hex", outer_checksum = "8E4E4ECFA7982859F430C57F549200C7749823C106759F4A19A78AEA6687717A" },
{ name = "gleamy_lights", version = "2.3.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_community_colour", "gleam_stdlib"], otp_app = "gleamy_lights", source = "hex", outer_checksum = "8A3D43BCA0D935F7CC787F4D0D1771F822B3366114C08B93CC8D00747618499A" },
{ name = "gleeunit", version = "1.3.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "A7DD6C07B7DA49A6E28796058AA89E651D233B357D5607006D70619CD89DAAAB" },
{ name = "glexer", version = "2.2.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glexer", source = "hex", outer_checksum = "5C235CBDF4DA5203AD5EAB1D6D8B456ED8162C5424FE2309CFFB7EF438B7C269" },
{ name = "houdini", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "houdini", source = "hex", outer_checksum = "5BA517E5179F132F0471CB314F27FE210A10407387DA1EA4F6FD084F74469FC2" },
{ name = "houdini", version = "1.2.0", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "5DB1053F1AF828049C2B206D4403C18970ABEF5C18671CA3C2D2ED0DD64F6385" },
{ name = "javascript_mutable_reference", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "javascript_mutable_reference", source = "hex", outer_checksum = "3EE953EE7FE4FAFD17C16F24184F4C832FE260D761753F28F20D4AC1DA080F03" },
{ name = "jot", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "houdini", "splitter"], otp_app = "jot", source = "hex", outer_checksum = "2C1B30CC00B0D79F904028F48229C0BB354F3C1BC05EE99D4F3D423E223D85BF" },
{ name = "jot", version = "5.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "houdini", "splitter"], otp_app = "jot", source = "hex", outer_checksum = "B1A0C91A3D273971D1CA1F644FF0A9CAC8256BDA249CADC927041BF14E7114A6" },
{ name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" },
{ name = "lustre", version = "5.0.3", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "0BB69D69A9E75E675AA2C32A4A0E5086041D037829FC8AD385BA6A59E45A60A2" },
{ name = "modem", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre"], otp_app = "modem", source = "hex", outer_checksum = "EF6B6B187E9D6425DFADA3A1AC212C01C4F34913A135DA2FF9B963EEF324C1F7" },
Expand All @@ -42,7 +42,7 @@ packages = [
{ name = "rank", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "rank", source = "hex", outer_checksum = "5660E361F0E49CBB714CC57CC4C89C63415D8986F05B2DA0C719D5642FAD91C9" },
{ name = "rsvp", version = "1.0.4", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_fetch", "gleam_http", "gleam_httpc", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "rsvp", source = "hex", outer_checksum = "EFCA7CD53B0A8738C06E136422D1FF080DBB657C89E077F7B9DD20BFACE0A77A" },
{ name = "simplifile", version = "2.2.1", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "C88E0EE2D509F6D86EB55161D631657675AA7684DAB83822F7E59EB93D9A60E3" },
{ name = "splitter", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "128FC521EE33B0012E3E64D5B55168586BC1B9C8D7B0D0CA223B68B0D770A547" },
{ name = "splitter", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "3DFD6B6C49E61EDAF6F7B27A42054A17CFF6CA2135FF553D0CB61C234D281DD0" },
{ name = "term_size", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "term_size", source = "hex", outer_checksum = "D00BD2BC8FB3EBB7E6AE076F3F1FF2AC9D5ED1805F004D0896C784D06C6645F1" },
{ name = "tom", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "tom", source = "hex", outer_checksum = "0910EE688A713994515ACAF1F486A4F05752E585B9E3209D8F35A85B234C2719" },
{ name = "trie_again", version = "1.1.3", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "trie_again", source = "hex", outer_checksum = "365FE609649F3A098D1D7FC7EA5222EE422F0B3745587BF2AB03352357CA70BB" },
Expand Down
Loading