From ee0e4584fa497e895bd088647562222650bf2a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Fri, 5 Jul 2024 00:11:17 +0200 Subject: [PATCH 1/2] Remove /docs/ from /topics/ URLs (#90) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We've decided earlier that we want short URLs on the form https://valkey.io/topics/acl The URLs (before this patch) contain /docs/topics/ and a trailing slash, like this: https://valkey.io/docs/topics/acl/ This change is to make the URLs shorter and more close to what's been decided. Additionally, in the docs repo, the links between the command pages and the topics pages are on the form "../topics/acl.md" and "../commands/client-kill.md" and this is also how the files are stored in the docs repo, so by putting "topics" at the same level as "commands" on the website too makes editing the docs more intuitive. I can't get rid of the trailing slash right now, so with this patch, the URLs look like https://valkey.io/topics/acl/ Redirects are added for the /docs/topics/ URLs. --------- Signed-off-by: Viktor Söderqvist --- .gitignore | 4 +- README.md | 6 +-- build/init-topics.sh | 23 +++++++--- config.toml | 66 ++++++++++++++--------------- content/docs/index.md | 10 ++--- content/{docs => }/topics/_index.md | 1 + templates/default.html | 2 +- templates/macros/command.html | 8 ++-- templates/macros/docs.html | 8 ++-- 9 files changed, 69 insertions(+), 59 deletions(-) rename content/{docs => }/topics/_index.md (74%) diff --git a/.gitignore b/.gitignore index 025317d..d5cc939 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ build-command-json build-topics content/commands/* !content/commands/_index.md -content/docs/topics/* -!content/docs/topics/_index.md +content/topics/* +!content/topics/_index.md _site \ No newline at end of file diff --git a/README.md b/README.md index 42cc928..056379a 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,11 @@ The instructions show how to use scripts that create symbolic links to the `valk ### Building the documentation topics -Documentation 'topics' (i.e. `/docs/topics/keyspace/`, `/docs/topics/encryption/`, `/docs/topics/transactions/`) sources content from `valkey-io/valkey-doc`. +Documentation 'topics' (i.e. `/topics/keyspace/`, `/topics/encryption/`, `/topics/transactions/`) sources content from `valkey-io/valkey-doc`. ```mermaid flowchart TD - A[Webpage: /docs/topics/keyspace/ ] + A[Webpage: /topics/keyspace/ ] A --> B[Template: valkey-io/valkey-website] B --> H[Repo: valkey-io/valkey-doc ] --> I[File: /topics/keyspace.md ] --> Y[Topic content] ``` @@ -58,7 +58,7 @@ From the root directory of this repo run: ``` Then, restart Zola. -Point your browser at `http://127.0.0.1:1111/docs/topics/` and you should see the fully populated list of topics. +Point your browser at `http://127.0.0.1:1111/topics/` and you should see the fully populated list of topics. All files created in this process are ignored by git. Commit your changes to your local copy of `valkey-io/valkey-doc`. diff --git a/build/init-topics.sh b/build/init-topics.sh index 05c3c21..d2e083c 100755 --- a/build/init-topics.sh +++ b/build/init-topics.sh @@ -1,6 +1,6 @@ #!/bin/bash # See README for usage -# This file will create stub files for all the docs/topics. +# This file will create stub files for all the topics. # first check to make sure there are arguments if [ -z "$1" ]; then @@ -14,28 +14,37 @@ if [ ! -d "$1" ]; then exit 1 fi +# check for old style /docs/topics +if [ -e "content/docs/topics" ]; then + echo "Documentation topic files have moved. Delete content/docs/topics before proceeding." + exit 1 +fi -ln -s $1 ./build-topics +# Create symlink to topics, except if it already exists and points to the same directory. +if [ ! -L build-topics -o "$(readlink build-topics)" != "$1" ]; then + ln -s $1 ./build-topics +fi for fname in $(find $1 -maxdepth 1 -iname "*.md") do base=${fname##*/} topic=${base%.*} - if [[ "$topic" != "index" ]]; then - cat << EOF > "./content/docs/topics/$topic.md" + if [[ "$topic" != "index" ]]; then + cat << EOF > "./content/topics/$topic.md" +++ # This is a generated stub file. # To edit the content see /topic/$topic.md in the 'valkey-doc' repo +aliases = ["/docs/topics/$topic/"] +++ EOF fi done -echo "Topic stub files created." +echo "Topic stub files created at content/topics." for fname in $(find $1 -maxdepth 1 -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.gif") do base=${fname##*/} - cp ${fname} ./content/docs/topics/${base} + cp ${fname} ./content/topics/${base} done -echo "Copied images to topics directory." \ No newline at end of file +echo "Copied images to topics directory." diff --git a/config.toml b/config.toml index 4446825..cfb94c9 100644 --- a/config.toml +++ b/config.toml @@ -19,40 +19,40 @@ command_json_path = "../build-command-json/" doc_topic_path = "../build-topics/" review_list = [ - "/docs/topics/license/", - "/docs/topics/admin/", - "/docs/topics/distlock/", - "/docs/topics/eval-intro/", - "/docs/topics/faq/", - "/docs/topics/functions-intro/", - "/docs/topics/hashes/", - "/docs/topics/internals-eventlib/", - "/docs/topics/internals-vm/", - "/docs/topics/internals/", - "/docs/topics/latency/", - "/docs/topics/lua-api/", - "/docs/topics/modules-blocking-ops/", - "/docs/topics/modules-intro/", - "/docs/topics/pipelining/", - "/docs/topics/programmability/", - "/docs/topics/protocol/", - "/docs/topics/pubsub/", - "/docs/topics/rdd/", - "/docs/topics/replication/", - "/docs/topics/security/", - "/docs/topics/sentinel-clients/", - "/docs/topics/sentinel/", - "/docs/topics/transactions/", - "/docs/topics/cluster-spec/", - "/docs/topics/history/" + "/topics/license/", + "/topics/admin/", + "/topics/distlock/", + "/topics/eval-intro/", + "/topics/faq/", + "/topics/functions-intro/", + "/topics/hashes/", + "/topics/internals-eventlib/", + "/topics/internals-vm/", + "/topics/internals/", + "/topics/latency/", + "/topics/lua-api/", + "/topics/modules-blocking-ops/", + "/topics/modules-intro/", + "/topics/pipelining/", + "/topics/programmability/", + "/topics/protocol/", + "/topics/pubsub/", + "/topics/rdd/", + "/topics/replication/", + "/topics/security/", + "/topics/sentinel-clients/", + "/topics/sentinel/", + "/topics/transactions/", + "/topics/cluster-spec/", + "/topics/history/" ] publish_hold = [ - "/docs/topics/protocol/", - "/docs/topics/license/", - "/docs/topics/internals-eventlib/", - "/docs/topics/internals-vm/", - "/docs/topics/internals/", - "/docs/topics/protocol/", - "/docs/topics/rdd/" + "/topics/protocol/", + "/topics/license/", + "/topics/internals-eventlib/", + "/topics/internals-vm/", + "/topics/internals/", + "/topics/protocol/", + "/topics/rdd/" ] \ No newline at end of file diff --git a/content/docs/index.md b/content/docs/index.md index 8ef7a6a..5aea63e 100644 --- a/content/docs/index.md +++ b/content/docs/index.md @@ -4,11 +4,11 @@ template = "fullwidth.html" page_template = "docs-page.html" +++ -* [Command Reference](../commands/) -* [All Documentation Topics](./topics/) +* [Command Reference](/commands/) +* [All Documentation Topics](/topics/) * Management - * [Persistence](/docs/topics/persistence/) + * [Persistence](/topics/persistence/) * Security - * [ACL](/docs/topics/acl/) + * [ACL](/topics/acl/) * Valkey Manual - * [Keyspace Notifications](/docs/topics/keyspace/) + * [Keyspace Notifications](/topics/keyspace/) diff --git a/content/docs/topics/_index.md b/content/topics/_index.md similarity index 74% rename from content/docs/topics/_index.md rename to content/topics/_index.md index 2587776..c759c28 100644 --- a/content/docs/topics/_index.md +++ b/content/topics/_index.md @@ -2,4 +2,5 @@ title = "Topics" template = "docs.html" page_template = "docs-page.html" +aliases = ["/docs/topics/"] +++ diff --git a/templates/default.html b/templates/default.html index 245a80f..8524446 100644 --- a/templates/default.html +++ b/templates/default.html @@ -55,4 +55,4 @@

Contact

- \ No newline at end of file + diff --git a/templates/macros/command.html b/templates/macros/command.html index 06bac9b..17fd157 100644 --- a/templates/macros/command.html +++ b/templates/macros/command.html @@ -53,9 +53,9 @@ {%- endmacro load_command_json -%} {%- macro fix_links(content) -%} -{{ content - | regex_replace(pattern=`\]\(\.\./topics/(?P.*?).md#(?P.*?)\)`, rep=`](/docs/topics/$fname#$hash)`) - | regex_replace(pattern=`\]\(\.\./topics/(?P.*?).md\)`, rep=`](/docs/topics/$fname)`) - | regex_replace(pattern=`\[(?P.*?)\]:\s+\.\./topics/(?P.*?).md`, rep=`[$token]: /docs/topics/$fname`) +{{ content + | regex_replace(pattern=`\]\(\.\./topics/(?P.*?).md#(?P.*?)\)`, rep=`](/topics/$fname#$hash)`) + | regex_replace(pattern=`\]\(\.\./topics/(?P.*?).md\)`, rep=`](/topics/$fname)`) + | regex_replace(pattern=`\[(?P.*?)\]:\s+\.\./topics/(?P.*?).md`, rep=`[$token]: /topics/$fname`) }} {%- endmacro fix_links -%} diff --git a/templates/macros/docs.html b/templates/macros/docs.html index 0ee54ab..2e7bb67 100644 --- a/templates/macros/docs.html +++ b/templates/macros/docs.html @@ -29,10 +29,10 @@ | regex_replace(pattern=`\]\(\.\./commands/(?P\w.*?)(.md)?#(?P.*?)\)`, rep=`](/commands/$fname#$hash)`) | regex_replace(pattern=`\]\(\.\./commands/(?P\w.*?)(.md)?\)`, rep=`](/commands/$fname)`) | regex_replace(pattern=`\]\(\.\./commands/#(?P\w.*?)\)`, rep=`](/commands/#$hash)`) - | regex_replace(pattern=`\]\((?P\w.*?)(.md)?#(?P.*?)\)`, rep=`](/docs/topics/$fname#$hash)`) - | regex_replace(pattern=`\]\((?P.*?).png\)`, rep=`](/docs/topics/$fname.png)`) - | regex_replace(pattern=`\]\((?P.*?).gif\)`, rep=`](/docs/topics/$fname.gif)`) - | regex_replace(pattern=`\]\((?P\w.*?)(.md)?\)`, rep=`](/docs/topics/$fname)`) + | regex_replace(pattern=`\]\((?P\w.*?)(.md)?#(?P.*?)\)`, rep=`](/topics/$fname#$hash)`) + | regex_replace(pattern=`\]\((?P.*?).png\)`, rep=`](/topics/$fname.png)`) + | regex_replace(pattern=`\]\((?P.*?).gif\)`, rep=`](/topics/$fname.gif)`) + | regex_replace(pattern=`\]\((?P\w.*?)(.md)?\)`, rep=`](/topics/$fname)`) | regex_replace(pattern=`\]\(\-(?Phttps?:\/\/.*?\))`, rep=`]($url`) | regex_replace(pattern=`\]\(\--(?P.*?\))`, rep=`](#$hash`) }} From 37a420186065981d5c3a432b23f81cfcedf9a82b Mon Sep 17 00:00:00 2001 From: Brian Wo <45139213+brainwo@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:28:25 +0800 Subject: [PATCH 2/2] adds title to config.toml Signed-off-by: Brian Wo <45139213+brainwo@users.noreply.github.com> --- config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/config.toml b/config.toml index cfb94c9..20b1617 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,5 @@ base_url = "https://valkey.io" +title = "Valkey" compile_sass = true