Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push to prod: Remove banner, organized docs, better link rewriting #158

Merged
merged 7 commits into from
Oct 22, 2024
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
4 changes: 1 addition & 3 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,4 @@ publish_hold = [
"/topics/internals/",
"/topics/protocol/",
"/topics/rdd/"
]

banner = "Valkey 8.0 is faster, more efficient, and more reliable. [Read more](/blog/valkey-8-ga/) or get [Valkey 8.0](/download/releases/v8-0-1/) today!"
]
17 changes: 7 additions & 10 deletions content/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
+++
title = "Docs"
template = "fullwidth.html"
title = "Documentation"
template = "block-menu.html"
page_template = "docs-page.html"
[extra]
body_class= "blocks-page"
+++

* [Command Reference](/commands/)
* [All Documentation Topics](/topics/)
* Management
* [Persistence](/topics/persistence/)
* Security
* [ACL](/topics/acl/)
* Valkey Manual
* [Keyspace Notifications](/topics/keyspace/)

* [Command Reference](/commands/) A categorized listing of all Valkey commands
* [Documentation by topic](/topics/) In-depth documentation covering a wide variety of operational and usage subjects
48 changes: 48 additions & 0 deletions sass/_valkey.scss
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,54 @@ pre table {

}

.index-entry {
padding: 0.5em 1em;
margin-bottom: 0.5em;
}

.block-menu ul li,
.index-entry {
border: 1px solid $line;
border-radius: 3px;
a {
display: block;
}
}

.block-menu {
ul {
display: flex;
flex-direction: row;
flex-wrap: wrap;
list-style-type: none;
padding: 0;
gap: 1em;
li {
text-align: center;
padding: 1em;
flex: 1 1 0px;
a {
text-align: center;
padding-bottom: 1em;
}
}
}
}

.blocks-page {
.container {
padding-right: 0;
}
}

@media (max-width: 768px) {
.block-menu ul {
display: block;
li {
margin-bottom: 1em;
}
}
}



Expand Down
8 changes: 8 additions & 0 deletions templates/block-menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "fullwidth.html" %}


{% block main_content %}
<div class="block-menu">
{{ page.content | markdown | safe }}
</div>
{% endblock main_content %}
7 changes: 6 additions & 1 deletion templates/commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ <h2>Alphabetical Command List</h2>
<li><code><a href="{{ entry[1] }}">{{ entry[0] }}</a></code></li>
{% endfor %}
</ul>
{% endblock related_content %}
{% endblock related_content %}


{% block subhead_content %}
<h1 class="page-title">Documentation: Command Reference</h1>
{% endblock subhead_content %}
14 changes: 10 additions & 4 deletions templates/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<html lang="{{ page.lang | default(value=config.default_language) }}">
{% include "includes/head.html" %}
<body
{%- if page.extra.sectionid -%}id="{{ page.extra.sectionid }}"{%- endif -%}
{%- if page.extra.body_class -%}class="{{ page.body_class }}"{%- endif -%}
{%- if page.extra.sectionid -%} id="{{ page.extra.sectionid }}"{%- endif -%}
{% if page.extra.body_class %} class="{{ page.extra.body_class }}"{% endif %}
{% if section.extra.body_class %} class="{{ section.extra.body_class }}"{% endif %}
>
{%- if config.extra.banner -%}
<div class="banner">
Expand All @@ -20,8 +21,13 @@
</a>
<nav role="navigation" aria-label="Main">
<a role="menuitem" href="/download/">Download</a>
<a role="menuitem" href="/docs/">Documentation</a>
<a role="menuitem" href="/commands/">Commands</a>
<div class="has-submenu">
<a role="menuitem" href="/docs/">Documentation</a>
<div class="submenu">
<a role="menuitem" href="/commands/">Command Reference</a>
<a role="menuitem" href="/topics/">Documentation by Topic</a>
</div>
</div>
<a role="menuitem" href="/blog/">Blog</a>
<div class="has-submenu">
<span>Community</span>
Expand Down
2 changes: 1 addition & 1 deletion templates/docs-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

{% block subhead_content %}
{% if has_frontmatter and frontmatter_title %}
<h1 class="page-title">{{ frontmatter_title }}</h1>
<h1 class="page-title">Documentation: {{ frontmatter_title }}</h1>
{% endif %}
{% endblock subhead_content %}

Expand Down
25 changes: 22 additions & 3 deletions templates/docs.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
{% extends "fullwidth.html" %}
{% extends "right-aside.html" %}

{% import "macros/docs.html" as docs %}

{% block subhead_content %}
<h1 class="page-title">Documentation by topic</h1>
{% endblock subhead_content %}

{% block main_content %}

{% set list = [] %}
{% if section.pages | length == 0 %}
<strong>No docs pages found.</strong> You likely need to build the documentation pages. See "Building additional content" in README.md file.
{% endif %}

{% set docs_file_contents = docs::load(slug= "index") %}
{% set frontmatter = docs::extract_frontmatter(content= docs_file_contents) %}
{% set page_contents = docs::extract_markdown(content= docs_file_contents) %}
{%- set content_with_fixed_links = docs::fix_links(content= page_contents) -%}


{{ content_with_fixed_links | markdown | safe }}
{% endblock main_content %}

{% block related_content %}
<h2>Alphabetical Index</h2>
{% for page in section.pages %}
{% set docs_file_contents = docs::load(slug= page.slug) %}
{% set frontmatter = docs::extract_frontmatter(content= docs_file_contents) %}
Expand All @@ -26,7 +43,9 @@
{% set topic_list = load_data(literal= "[" ~ joined_list ~ "]", format="json") | sort(attribute="title") %}

{% for topic in topic_list %}
<a href="{{ topic.path }}">{{ topic.title }}</a> {{ topic.description | safe }} <br />
<div class="index-entry">
<a href="{{ topic.path }}">{{ topic.title }}</a> {{ topic.description | safe }} <br />
</div>
{% endfor %}

{% endblock main_content %}
{% endblock related_content %}
1 change: 1 addition & 0 deletions templates/macros/command.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
| 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`)
| regex_replace(pattern=`\[(?P<token>.*?)\]:\s+(?P<fname>.*?).md`, rep=`[$token]: $fname`)
}}
{%- endmacro fix_links -%}
12 changes: 12 additions & 0 deletions templates/macros/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@
| 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)\)`, rep=`](/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`)
| regex_replace(pattern=`\.\.\/commands\/`, rep=`/commands/`)

| regex_replace(pattern=`\[(?<id>.*)\]:\s*https://(?P<url>.*)`, rep=`[$id} https://$url`)

| regex_replace(pattern=`\[(?<id>.*)\]:\s*(?P<topic>.*)(\.md)`, rep=`[$id]: /topics/$topic`)

| regex_replace(pattern=`\]\(\/topics\/(?P<url>http:\/\/.*?\))`, rep=`]($url`)



| regex_replace(pattern=`\[(?<id>.*)\}\s*(?P<url>.*)`, rep=`[$id]: $url`)
}}
{%- endmacro fix_links -%}