From 96cf4b40f436e4e27268075dc1c9a8593f09c3f2 Mon Sep 17 00:00:00 2001 From: Private Maker Date: Mon, 3 Feb 2025 18:47:17 +0000 Subject: [PATCH 1/4] make site hugo module & add headless-cms dependency --- go.mod | 5 +++++ go.sum | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..f208f9d2c --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/ooni/ooni.org + +go 1.21.1 + +require github.com/privatemaker/headless-cms v0.1.1 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..a58ef95c9 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/privatemaker/headless-cms v0.1.1 h1:pYDKvV8ZmgrAaH5WTtKP1TrwpIXSj3t9u72sTfCxDWE= +github.com/privatemaker/headless-cms v0.1.1/go.mod h1:ZcHkPZzL9yCsBdmn9FpoIW35snTyj1bDOfqT0ZFJoZE= From f504350f3a37e4be465cb4ff79e82cb9be9b44c5 Mon Sep 17 00:00:00 2001 From: Private Maker Date: Mon, 3 Feb 2025 19:12:13 +0000 Subject: [PATCH 2/4] move config.toml to config/ dir and add Sveltia CMS starter --- config.toml => config/_default/config.toml | 8 ++++---- config/_default/params.yaml | 8 ++++++++ content/admin/_index.md | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) rename config.toml => config/_default/config.toml (83%) create mode 100644 config/_default/params.yaml create mode 100644 content/admin/_index.md diff --git a/config.toml b/config/_default/config.toml similarity index 83% rename from config.toml rename to config/_default/config.toml index 2f034c64d..63d605a96 100644 --- a/config.toml +++ b/config/_default/config.toml @@ -6,9 +6,6 @@ pluralizeListTitles = false timeout = 120000 publishDir = "public/" -[params] -description = "The Open Observatory of Network Interference (OONI) is a global community measuring internet censorship around the world. Run OONI Probe to detect internet censorship. Use OONI Explorer to track internet censorship worldwide in near real-time." - [Languages] [Languages.ar] [Languages.ca] @@ -26,6 +23,9 @@ description = "The Open Observatory of Network Interference (OONI) is a global c [Languages.my] [Languages.kk] +[[module.imports]] + path = "github.com/privatemaker/headless-cms" + [outputFormats] [outputFormats.PageIndex] mediaType = "application/json" @@ -34,7 +34,7 @@ isPlainText = true notAlternative = true [outputs] - home = ["HTML", "PageIndex", "RSS"] + home = ["HTML", "PageIndex", "RSS", "HeadlessCMSConfig" ] [caches] [caches.getjson] diff --git a/config/_default/params.yaml b/config/_default/params.yaml new file mode 100644 index 000000000..614872612 --- /dev/null +++ b/config/_default/params.yaml @@ -0,0 +1,8 @@ +description: "The Open Observatory of Network Interference (OONI) is a global community measuring internet censorship around the world. Run OONI Probe to detect internet censorship. Use OONI Explorer to track internet censorship worldwide in near real-time." + +headless_cms: + engine: "sveltia" + site_url: "https://ooni.org" + backend: + name: "github" + repo: "ooni/ooni.org" diff --git a/content/admin/_index.md b/content/admin/_index.md new file mode 100644 index 000000000..cc034fee3 --- /dev/null +++ b/content/admin/_index.md @@ -0,0 +1,4 @@ +--- +title: OONI Website CMS +layout: headless-cms +--- From 98c7116c4ac6c533db26922bef071be6a1e076fc Mon Sep 17 00:00:00 2001 From: Private Maker Date: Mon, 3 Feb 2025 19:31:58 +0000 Subject: [PATCH 3/4] add first pass of Sveltia CMS config for content/post/ content --- config/_default/params.yaml | 71 +++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/config/_default/params.yaml b/config/_default/params.yaml index 614872612..cd7be17de 100644 --- a/config/_default/params.yaml +++ b/config/_default/params.yaml @@ -4,5 +4,72 @@ headless_cms: engine: "sveltia" site_url: "https://ooni.org" backend: - name: "github" - repo: "ooni/ooni.org" + name: "github" + repo: "ooni/ooni.org" + commit_messages: + create: "Create {{slug}} ({{collection}})" + update: "Update {{slug}} ({{collection}})" + delete: "Delete {{slug}} ({{collection}})" + uploadMedia: "Upload - {{path}}" + deleteMedia: "Delete - {{path}}" + openAuthoring: '{{message}}' + publish_mode: "simple" + media_folder: "static/images/uploads" + public_folder: "/images/uploads" + locale: "en" + slug: + encoding: "ascii" + clean_accents: true + sanitize_replacement: "-" + collections: + - name: "blog" + label: "Blog Posts" + label_singular: "Blog Post" + folder: "content/post" + path: "{{slug}}/index" + media_folder: "images" + public_folder: "" + create: true + delete: false + widget: "list" + preview_path: "post/{{slug}}" + editor: + preview: true + fields: + - label: "Title" + name: "title" + widget: "string" + - lable: "Draft" + name: "draft" + widget: "boolean" + - label: "Description" + name: "description" + widget: "string" + - label: "Author" + name: "author" + widget: "string" + - label: "Publish Date" + name: "date" + widget: "datetime" + format: "ll" + - label: "Image" + name: "thumbnail" + widget: "image" + choose_url: true + media_library: + config: + multiple: true + - label: "Body" + name: "body" + widget: "markdown" + - label: "Tags" + name: "tags" + widget: "list" + allow_add: true + - label: "Categories" + name: "categories" + widget: "select" + default: "report" + options: + - { value: "report", label: "Report" } + - { value: "blog", label: "Blog" } From 656c36c795d540b5f7f92686fa0d40568686361c Mon Sep 17 00:00:00 2001 From: Private Maker Date: Tue, 4 Feb 2025 13:01:02 +0100 Subject: [PATCH 4/4] add hugo mod get to build_website.sh --- scripts/build_website.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build_website.sh b/scripts/build_website.sh index f51d9840b..e856de4e1 100755 --- a/scripts/build_website.sh +++ b/scripts/build_website.sh @@ -7,6 +7,7 @@ fi echo "Using BASE_URL=$BASE_URL" npm install mkdir -p public/ +hugo mod get -u hugo --minify --buildDrafts --baseURL="$BASE_URL" cp static/googlec8ce605468a38232.html public/ cp static/robots.txt public/