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

add docs menu sections #1366

Merged
merged 1 commit into from
May 17, 2018
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
16 changes: 15 additions & 1 deletion website/site/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@ languageCode: "en-us"
title: "Netlify CMS | Open-Source Content Management System"
disable404: true
pluralizeListTitles: false
metaDataFormat: "yaml"
metaDataFormat: "yaml"
menu:
docs:
- name: start
title: Quick Start
weight: 100
- name: guides
title: Guides
weight: 200
- name: reference
title: Reference
weight: 300
- name: contributing
title: Contributing
weight: 400
6 changes: 5 additions & 1 deletion website/site/content/docs/add-to-your-site.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
title: Add to Your Site
position: 20
weight: 20
menu:
docs:
parent: start
---

# Add Netlify CMS to Your Site

Netlify CMS is adaptable to a wide variety of projects. The only inflexible requirement is that your site content must be written in markdown, JSON, YAML, or TOML files, stored in a repo on [GitHub](https://github.com/). (If you're partial to another Git hosting service, check out the PRs in progress for [GitLab](https://github.com/netlify/netlify-cms/pull/517) and [Bitbucket](https://github.com/netlify/netlify-cms/pull/525) support.)
Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/authentication-backends.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Authentication & Backends
position: 25
weight: 25
menu:
docs:
parent: start
---
# Authentication & Backends

Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/beta-features.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Beta Features!
position: 200
weight: 200
menu:
docs:
parent: reference
---
# Beta Features!
We run new functionality in an open beta format from time to time. That means that this functionality is totally available for use, and we _think_ it might be ready for primetime, but it could break or change without notice.
Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/collection-types.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Collection Types
position: 27
weight: 27
menu:
docs:
parent: start
---
# Collection Types

Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/configuration-options.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Configuration Options
position: 23
weight: 23
menu:
docs:
parent: reference
---

# Configuration Options
Expand Down
7 changes: 5 additions & 2 deletions website/site/content/docs/contributor-guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Contributing
position: 100
title: Contributor Guide
weight: 100
menu:
docs:
parent: contributing
---

# Welcome, contributors!
Expand Down
7 changes: 5 additions & 2 deletions website/site/content/docs/custom-widgets.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Custom Widgets
position: 35
title: Creating Custom Widgets
weight: 35
menu:
docs:
parent: guides
---
# Custom Widgets

Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Examples
position: 110
weight: 110
menu:
docs:
parent: start
---

# Examples
Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Introduction
position: 0
weight: 1
menu:
docs:
parent: start
---

# Introduction
Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/start-with-a-template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Start with a Template
position: 10
weight: 10
menu:
docs:
parent: start
---

# Start with a Template
Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/update-the-cms-version.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Update the CMS Version
position: 60
weight: 60
menu:
docs:
parent: start
---

# Update the CMS Version
Expand Down
5 changes: 4 additions & 1 deletion website/site/content/docs/widgets/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: Widgets
position: 30
weight: 30
menu:
docs:
parent: reference
---

# Widgets
Expand Down
35 changes: 0 additions & 35 deletions website/site/layouts/_default/list.html

This file was deleted.

71 changes: 40 additions & 31 deletions website/site/layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
{{ partial "header" . }}
{{ $activePage := .Params.position }}

<div class="docs detail page">
<div class="container">
<aside id="sidebar" class="sidebar">
<nav class="docs-nav" id="docs-nav">
{{ $subjects := where .Site.Pages "Section" "docs" }}
{{ range sort $subjects "Params.position" }}
{{- if ne .Type "widget" -}}
<a href="{{ .Permalink }}" class="nav-link {{ if eq .Params.position $activePage }}active{{ end }}">{{ .Title }}</a>
{{- end -}}
{{ end }}
</nav>
<div class="mobile docs-nav">
<select class="btn-primary" id="mobile-docs-nav">
<option value="" selected="selected">Select A Topic</option>
{{ $subjects := where .Site.Pages "Section" "docs" }}
{{ range sort $subjects "Params.position" }}
{{- if ne .Type "widget" -}}
<option value="{{ .Permalink }}" class="nav-link {{ if eq .Params.position $activePage }}active{{ end }}">{{ .Title }}</option>
{{- end -}}
{{ end }}
</select>
</div>
</aside>
<article class="docs-content" id="docs-content">
{{ partial "edit-link" . }}
{{ .Content }}
{{- if eq .Title "Widgets" -}} <!-- Check if is widgets page, if so, add the partial "widgets" for the widget cloud functionality -->
{{- partial "widgets" . -}}
{{- end -}}
</article>
</div>
<div class="docs page">
<div class="container">
<aside id="sidebar" class="sidebar">
<nav id="docs-nav" class="docs-nav" id="docs-nav">
{{ $currentPage := . }}
{{ range $index, $element := .Site.Menus.docs }}
{{ if .HasChildren }}
<div class="docs-nav-section">
<div class="docs-nav-section-title">{{ .Title }}</div>
<ul class="docs-nav-section-list">
{{ range .Children }}
<a href="{{ .URL }}" class="nav-link {{ if $currentPage.IsMenuCurrent "docs" . }}active{{ end }}">{{ .Title }}</a>
{{ end }}
</ul>
</div>
{{ end }}
{{ end }}
</nav>
<div class="mobile docs-nav">
<select class="btn-primary" id="mobile-docs-nav">
<option value="" selected="selected">Select A Topic</option>
{{ range $index, $element := .Site.Menus.docs }}
{{ if .HasChildren }}
<optgroup label="{{ .Title }}"/>
{{ range .Children }}
<option value="{{ .URL }}" class="nav-link {{ if $currentPage.IsMenuCurrent "docs" . }}active{{ end }}">{{ .Title }}</option>
{{ end }}
{{ end }}
{{ end }}
</select>
</div>
</aside>
<article class="docs-content" id="docs-content">
{{ partial "edit-link" . }}
{{ .Content }}
{{- if eq .Title "Widgets" -}} <!-- Check if is widgets page, if so, add the partial "widgets" for the widget cloud functionality -->
{{- partial "widgets" . -}}
{{- end -}}
</article>
</div>
</div>

{{ partial "footer" . }}
2 changes: 1 addition & 1 deletion website/site/layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{{ end }}
</div>
<div class="nav-container">
<a class="nav-link docs-link" href="/docs">Docs</a>
<a class="nav-link docs-link" href="/docs/intro/">Docs</a>
<a class="nav-link contributing-link" href="/docs/contributor-guide">Contributing</a>
<a class="nav-link" href="/community">Community</a>
<a id="ghstars" class="github-button" href="https://github.com/netlify/netlify-cms" data-icon="octicon-star" data-show-count="true" aria-label="Star netlify/netlify-cms on GitHub">Star</a>
Expand Down
13 changes: 7 additions & 6 deletions website/site/static/_redirects
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/docs/custom-authentication /docs/authentication-backends 301
/docs/extending /docs/custom-widgets 301
/docs/validation /docs/custom-widgets/#advanced-field-validation 301
/docs/editorial-workflow /docs/configuration/#publish-mode 301
/docs/test-drive /docs/start-with-a-template 301
/docs/quick-start /docs/add-to-your-site 301
/docs /docs/intro 301
/docs/custom-authentication /docs/authentication-backends 301
/docs/extending /docs/custom-widgets 301
/docs/validation /docs/custom-widgets/#advanced-field-validation 301
/docs/editorial-workflow /docs/configuration/#publish-mode 301
/docs/test-drive /docs/start-with-a-template 301
/docs/quick-start /docs/add-to-your-site 301
20 changes: 19 additions & 1 deletion website/src/css/imports/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

@media screen and (min-width: $tablet) {
display: block;
height: 100%;
overflow-y: auto;
}

&.mobile {
Expand Down Expand Up @@ -70,8 +72,10 @@
.subnav-link {
display: block;
font-weight: $regular;
font-size: $tiny;
color: $grey;
line-height: 32px;
line-height: 1.3;
margin: 10px 0;
text-decoration: none;
text-transform: capitalize;
transition: color .2s ease;
Expand All @@ -87,6 +91,20 @@
}
}

.docs-nav-section {
margin-bottom: 30px;
}

.docs-nav-section-list {
margin: 0;
}

.docs-nav-section-title {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}

.nav-subsections {
margin: $tiny 0;
padding: 0 0 0 $tiny;
Expand Down