Skip to content

Commit

Permalink
update docs nav definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Mineev authored and umputun committed Aug 5, 2021
1 parent ad1f95d commit a45c1d1
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 105 deletions.
4 changes: 1 addition & 3 deletions site/.eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { format } = require('date-fns')
const htmlmin = require('html-minifier')
const navigationPlugin = require('@11ty/eleventy-navigation')
const syntaxHighlightPlugin = require('@11ty/eleventy-plugin-syntaxhighlight')

function noteContainer() {
Expand Down Expand Up @@ -68,7 +67,7 @@ module.exports = function (eleventyConfig) {

eleventyConfig.addFilter(
'debug',
(content) => `<pre>${JSON.stringify(content, null, 2)}</pre>`
(content = {}) => `<pre>${JSON.stringify(content, null, 2)}</pre>`
)

// Minify HTML output
Expand All @@ -85,7 +84,6 @@ module.exports = function (eleventyConfig) {

eleventyConfig.setLibrary('md', getMarkdownLib())
eleventyConfig.addPlugin(syntaxHighlightPlugin)
eleventyConfig.addPlugin(navigationPlugin)

eleventyConfig.addCollection('docs', (collection) =>
collection.getFilteredByGlob('src/docs/**/*.md')
Expand Down
1 change: 0 additions & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
},
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-navigation": "^0.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^3.1.1",
"@tailwindcss/typography": "^0.4.1",
"autoprefixer": "^10.2.6",
Expand Down
1 change: 0 additions & 1 deletion site/src/data/layout.js

This file was deleted.

3 changes: 0 additions & 3 deletions site/src/docs/backup/automatic/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Automatic Backup
menuTitle: Automatic
parent: Backup
order: 400
---

Remark42 by default makes daily backup files under `${BACKUP_PATH}` (default `./var/backup`). Backups kept up to `${MAX_BACKUP_FILES}` (default 10). Each backup file contains exported and gzipped content, i.e. all comments. At any point, the user can restore such backup and revert all comments to the desired state.
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/backup/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
layout: redirect.njk
destination: /docs/backup/automatic/
title: Backup
order: 300
---
3 changes: 0 additions & 3 deletions site/src/docs/backup/manual/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Manual Backup
menuTitle: Manual
parent: Backup
order: 300
---

You can make a backup manually whenever you want. Run command:
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/backup/migration/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Migration
parent: Backup
order: 300
---

Remark42 supports importing comments from Disqus, WordPress, or native backup format. All imported comments have an `Imported` field set to `true`.
Expand Down
3 changes: 0 additions & 3 deletions site/src/docs/backup/restore/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Restore Backup
menuTitle: Restore
parent: Backup
order: 300
---

Restore will clean all comments first and then will process with complete import from a given file.
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/backup/url-migration/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Site URL migration
parent: Backup
order: 400
---

Here is an example on how to move your comments after your posts are moved, from `https://example.org/blog/<slug>` to `https://example.org/post/<slug>` in that example.
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/configuration/authorization/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Authorization
parent: Configuration
order: 200
---

## OAuth Providers
Expand Down
3 changes: 0 additions & 3 deletions site/src/docs/configuration/email/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Email Settings
menuTitle: Email
parent: Configuration
order: 300
---

## Overview
Expand Down
3 changes: 0 additions & 3 deletions site/src/docs/configuration/frontend/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Frontend Configuration
menuTitle: Frontend
parent: Configuration
order: 100
---

## Comments
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/configuration/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
layout: redirect.njk
destination: /docs/configuration/frontend/
title: Configuration
order: 200
---
3 changes: 0 additions & 3 deletions site/src/docs/configuration/kubernetes/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Deploy with Kubernetes
menuTitle: Kubernetes
parent: Configuration
order: 700
---

## Using Helm
Expand Down
3 changes: 0 additions & 3 deletions site/src/docs/configuration/nginx/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Configure with Nginx
menuTitle: Nginx
parent: Configuration
order: 500
---

## How to configure remark42 with nginx reverse proxy
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/configuration/notifications/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Notification
parent: Configuration
order: 400
---

## Email
Expand Down
4 changes: 1 addition & 3 deletions site/src/docs/configuration/reproxy/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Reproxy
parent: Configuration
order: 600
title: Configure with Reproxy
---

## How to configure remark42 with [Reproxy](https://reproxy.io)
Expand Down
3 changes: 0 additions & 3 deletions site/src/docs/configuration/subdomain/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Configure Instance on Subdomain
menuTitle: Subdomain
parent: Configuration
order: 600
---

## How to configure remark42 without a subdomain
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/contributing/api/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: API
parent: Contributing
order: 400
---

## Authorization
Expand Down
4 changes: 0 additions & 4 deletions site/src/docs/contributing/development/backend/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
---
title: Backend Development Guidelines
menuTitle: Backend
key: Backend Guidelines
parent: Development
order: 100
---

In Progress...
4 changes: 0 additions & 4 deletions site/src/docs/contributing/development/frontend/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
---
title: Frontend Development Guidelines
menuTitle: Frontend
key: Frontend Guidelines
parent: Development
order: 100
---

### Code Style
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/contributing/development/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Development
parent: Contributing
order: 200
---

You can use a fully functional local version to develop and test both frontend and backend. It requires at least 2GB RAM or swap enabled.
Expand Down
4 changes: 1 addition & 3 deletions site/src/docs/contributing/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
layout: redirect.njk
destination: /docs/contributing/code-of-conduct/
title: Contributing
order: 500
destination: /docs/contributing/development/
---
2 changes: 0 additions & 2 deletions site/src/docs/contributing/technical-details/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Technical Details
order: 600
parent: Contributing
---

Remark42 uses boltdb (embedded key/value database) files under `STORE_BOLT_PATH` for storing data. Each site stored in a separate boltbd file.
Expand Down
3 changes: 0 additions & 3 deletions site/src/docs/contributing/translations/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Interface Translations
menuTitle: Translations
parent: Contributing
order: 300
---

## Add a New Language to Remark42
Expand Down
10 changes: 2 additions & 8 deletions site/src/docs/docs.11tydata.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
module.exports = {
eleventyComputed: {
eleventyNavigation: {
key: (data) => data.key || data.menuTitle || data.title,
title: (data) => data.menuTitle || data.title,
parent: (data) => data.parent,
order: (data) => data.order,
},
},
nav: require('./nav.json'),
layout: 'docs.njk',
}
2 changes: 0 additions & 2 deletions site/src/docs/getting-started/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
title: Getting Started
layout: redirect.njk
destination: /docs/getting-started/installation/
order: 100
---
2 changes: 0 additions & 2 deletions site/src/docs/getting-started/installation/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Installation
parent: Getting Started
order: 100
---

## Setup Remark42 Instance on Your Server
Expand Down
2 changes: 0 additions & 2 deletions site/src/docs/getting-started/system-requirements/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: System Requirements
parent: Getting Started
order: 200
---

In progress...
54 changes: 54 additions & 0 deletions site/src/docs/nav.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[
{
"section": "Getting Started",
"children": [
{ "title": "Installation", "href": "/getting-started/installation/" },
{
"title": "System Requirements",
"href": "/getting-started/system-requirements/"
}
]
},
{
"section": "Configuration",
"children": [
{ "title": "Frontend", "href": "/configuration/frontend/" },
{ "title": "Authorization", "href": "/configuration/authorization/" },
{ "title": "Email", "href": "/configuration/email/" },
{ "title": "Notifications", "href": "/configuration/notifications/" },
{ "title": "Nginx", "href": "/configuration/nginx/" },
{ "title": "Reproxy", "href": "/configuration/reproxy/" },
{ "title": "Subdomain", "href": "/configuration/subdomain/" },
{ "title": "Kubernetes", "href": "/configuration/kubernetes/" }
]
},
{
"section": "Backup",
"children": [
{ "title": "Manual", "href": "/backup/manual/" },
{ "title": "Migration", "href": "/backup/migration/" },
{ "title": "Restore", "href": "/backup/restore/" },
{ "title": "Site URL migration", "href": "/backup/url-migration/" },
{ "title": "Automatic", "href": "/backup/automatic/" }
]
},
{
"section": "Contrubuting",
"children": [
{
"title": "Development",
"href": "/contributing/development/",
"children": [
{ "title": "Backend", "href": "/contributing/development/backend/" },
{ "title": "Frontend", "href": "/contributing/development/frontend/" }
]
},
{ "title": "Translations", "href": "/contributing/translations/" },
{ "title": "API", "href": "/contributing/api/" },
{
"title": "Technical Details",
"href": "/contributing/technical-details/"
}
]
}
]
38 changes: 20 additions & 18 deletions site/src/includes/components/docs-aside.njk
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{% macro renderList(entry, level) %}
{% if level === 1 %}
<h5 class="uppercase font-semibold text-sm text-gray-400 mb-2">{{ entry.title }}</h5>
{% else %}
{% macro navItem(entry) %}
<li class="my-1">
<a class="py-1 px-2 -mx-2 block rounded text-gray-600 dark:text-gray-300 {% if entry.url === page.url %} bg-brand-100 dark:bg-brand-900 text-brand-600 dark:text-brand-400 hover:text-brand-600{% else %} hover:text-gray-900 dark:hover:text-gray-400{% endif %}" href="{{ entry.url | url }}">{{ entry.title }}</a>
{% endif %}
{% if entry.children and level < 2 %}
<ul class="mb-8 font-medium">
{% for child in entry.children %}
{{renderList(child, level + 1)}}
{% endfor %}
</ul>
{% endif %}
{% if entry.children and level >= 2 and page.url.startsWith(entry.url) %}
<a class="py-1 px-2 -mx-2 block rounded text-gray-600 dark:text-gray-300 {% if page.url === '/docs' + entry.href %} bg-brand-100 dark:bg-brand-900 text-brand-600 dark:text-brand-400 hover:text-brand-600{% else %} hover:text-gray-900 dark:hover:text-gray-400{% endif %}" href="/docs{{ entry.href | url }}">
{{ entry.title }}
</a>
{% if entry.children and page.url.startsWith('/docs' + entry.href) %}
<ul class="ml-4 font-normal">
{% for child in entry.children %}
{{renderList(child, level + 1)}}
{% for entry in entry.children %}
<li class="my-1">
<a class="py-1 px-2 -mx-2 block rounded text-gray-600 dark:text-gray-300 {% if page.url === '/docs' + entry.href %} bg-brand-100 dark:bg-brand-900 text-brand-600 dark:text-brand-400 hover:text-brand-600{% else %} hover:text-gray-900 dark:hover:text-gray-400{% endif %}" href="/docs{{ entry.href | url }}">
{{ entry.title }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
Expand All @@ -33,8 +28,15 @@
Open Menu
</label>
<nav class="hidden md:block mr-10">
{% for entry in collections.docs | eleventyNavigation %}
{{renderList(entry, 1)}}
{% for entry in nav %}
{% if entry.section %}
<h5 class="uppercase font-semibold text-sm text-gray-400 mb-2">{{ entry.section }}</h5>
{% endif %}
<ul class="mb-8 font-medium">
{% for entry in entry.children %}
{{ navItem(entry) }}
{% endfor %}
</ul>
{% endfor %}
</nav>
</aside>
4 changes: 2 additions & 2 deletions site/src/layouts/docs.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ layout: base.njk
</aside>
#}
<div class="order-1 max-w-full flex-grow">
<h1 class="text-2xl md:text-4xl font-bold mb-6 md:mb-8 text-brand-900 dark:text-brand-100">{{ title }}</h1>
<h1 class="text-2xl md:text-4xl font-bold mb-6 md:mb-8 text-brand-900 dark:text-brand-100">{{ title }}</h1>
<div class="prose dark:prose-dark">{{ layoutContent | safe }}</div>
</div>
<footer class="order-3 min-w-full flex mt-4 justify-end mr-1 text-sm text-gray-500 dark:text-gray-300 space-x-3 leading-5">
Expand All @@ -24,7 +24,7 @@ layout: base.njk
<a class="border-b border-transparent transition-colors hover:border-current" target="_blank" rel="noopener noreferrer" href="{{ site.githubUrl }}/edit/{{ site.githubBranch }}/site/{{ page.inputPath }}">Edit</a>
</footer>
</article>
{# TODO: implement navigation to next page of the docs
{# TODO: implement navigation to next page of the docs
<nav class="flex justify-between mt-10 mb-8 p-2 border-t dark:border-gray-700 text-gray-800 dark:text-gray-200">
<a>Prev page</a>
<a>Next page</a>
Expand Down
7 changes: 0 additions & 7 deletions site/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
resolved "https://registry.yarnpkg.com/@11ty/dependency-tree/-/dependency-tree-1.0.0.tgz#b1fa53da49aafe0ab3fe38bc6b6058b704aa59a1"
integrity sha512-2FWYlkphQ/83MG7b9qqBJfJJ0K9zupNz/6n4EdDuNLw6hQHGp4Sp4UMDRyBvA/xCTYDBaPSuSjHuu45tSujegg==

"@11ty/eleventy-navigation@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@11ty/eleventy-navigation/-/eleventy-navigation-0.2.0.tgz#fd610a4a3d52934b54832be5268dddf4b2fd22f4"
integrity sha512-mkFoNpL32FosMTuZwxcY3KXVVYLRt7zBqVWP9X+0GMufnRNGpLZd+BYwD0vmYHLAxz1ol/RLlL2Hmkgp/YJ4TQ==
dependencies:
dependency-graph "^0.11.0"

"@11ty/eleventy-plugin-syntaxhighlight@^3.1.1":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@11ty/eleventy-plugin-syntaxhighlight/-/eleventy-plugin-syntaxhighlight-3.1.1.tgz#0abfd8f0b2902629bd90aea69e8c8a0236d03ca4"
Expand Down

0 comments on commit a45c1d1

Please sign in to comment.