Skip to content

Commit

Permalink
Merge pull request #95 from valkey-io/main
Browse files Browse the repository at this point in the history
Push to prod: relocate `/docs/topics` to `/topics`
  • Loading branch information
stockholmux authored Jul 8, 2024
2 parents 5a1e23c + b0dbe6e commit 823817e
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
```
Expand All @@ -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`.

Expand Down
23 changes: 16 additions & 7 deletions build/init-topics.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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."
echo "Copied images to topics directory."
67 changes: 34 additions & 33 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
base_url = "https://valkey.io"
title = "Valkey"

compile_sass = true

Expand All @@ -19,40 +20,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/"
]
10 changes: 5 additions & 5 deletions content/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
1 change: 1 addition & 0 deletions content/docs/topics/_index.md → content/topics/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
title = "Topics"
template = "docs.html"
page_template = "docs-page.html"
aliases = ["/docs/topics/"]
+++
2 changes: 1 addition & 1 deletion templates/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ <h4>Contact</h4>
</div>
</div>
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions templates/macros/command.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
{%- endmacro load_command_json -%}

{%- macro fix_links(content) -%}
{{ content
| regex_replace(pattern=`\]\(\.\./topics/(?P<fname>.*?).md#(?P<hash>.*?)\)`, rep=`](/docs/topics/$fname#$hash)`)
| regex_replace(pattern=`\]\(\.\./topics/(?P<fname>.*?).md\)`, rep=`](/docs/topics/$fname)`)
| regex_replace(pattern=`\[(?P<token>.*?)\]:\s+\.\./topics/(?P<fname>.*?).md`, rep=`[$token]: /docs/topics/$fname`)
{{ content
| regex_replace(pattern=`\]\(\.\./topics/(?P<fname>.*?).md#(?P<hash>.*?)\)`, rep=`](/topics/$fname#$hash)`)
| regex_replace(pattern=`\]\(\.\./topics/(?P<fname>.*?).md\)`, rep=`](/topics/$fname)`)
| regex_replace(pattern=`\[(?P<token>.*?)\]:\s+\.\./topics/(?P<fname>.*?).md`, rep=`[$token]: /topics/$fname`)
}}
{%- endmacro fix_links -%}
8 changes: 4 additions & 4 deletions templates/macros/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
| regex_replace(pattern=`\]\(\.\./commands/(?P<fname>\w.*?)(.md)?#(?P<hash>.*?)\)`, rep=`](/commands/$fname#$hash)`)
| regex_replace(pattern=`\]\(\.\./commands/(?P<fname>\w.*?)(.md)?\)`, rep=`](/commands/$fname)`)
| regex_replace(pattern=`\]\(\.\./commands/#(?P<hash>\w.*?)\)`, rep=`](/commands/#$hash)`)
| regex_replace(pattern=`\]\((?P<fname>\w.*?)(.md)?#(?P<hash>.*?)\)`, rep=`](/docs/topics/$fname#$hash)`)
| regex_replace(pattern=`\]\((?P<fname>.*?).png\)`, rep=`](/docs/topics/$fname.png)`)
| regex_replace(pattern=`\]\((?P<fname>.*?).gif\)`, rep=`](/docs/topics/$fname.gif)`)
| regex_replace(pattern=`\]\((?P<fname>\w.*?)(.md)?\)`, rep=`](/docs/topics/$fname)`)
| regex_replace(pattern=`\]\((?P<fname>\w.*?)(.md)?#(?P<hash>.*?)\)`, rep=`](/topics/$fname#$hash)`)
| regex_replace(pattern=`\]\((?P<fname>.*?).png\)`, rep=`](/topics/$fname.png)`)
| regex_replace(pattern=`\]\((?P<fname>.*?).gif\)`, rep=`](/topics/$fname.gif)`)
| regex_replace(pattern=`\]\((?P<fname>\w.*?)(.md)?\)`, rep=`](/topics/$fname)`)
| regex_replace(pattern=`\]\(\-(?P<url>https?:\/\/.*?\))`, rep=`]($url`)
| regex_replace(pattern=`\]\(\--(?P<hash>.*?\))`, rep=`](#$hash`)
}}
Expand Down

0 comments on commit 823817e

Please sign in to comment.