Add links to languages and collapsible navigation

This commit is contained in:
Eugen Rochko 2018-10-06 02:23:56 +02:00
parent b8e793f6b7
commit 50f87589cb
10 changed files with 58 additions and 23 deletions

View File

@ -25,11 +25,6 @@ enableGitInfo = true
weight = 2 weight = 2
identifier = "administration" identifier = "administration"
url = "/administration/" url = "/administration/"
[[menu.docs]]
name = "Developer guide"
weight = 3
identifier = "development"
url = "/development/"
[[menu.docs]] [[menu.docs]]
name = "API Overview" name = "API Overview"
weight = 4 weight = 4

15
content/en/_index.md Normal file
View File

@ -0,0 +1,15 @@
---
title: Mastodon documentation
---
Welcome to the Mastodon documentation!
<div style="margin-bottom: 26px">
{{< youtube "IPSbNdBmWKE" >}}
</div>
**Choose your path:**
- [Learn how to use Mastodon]({{< relref "usage/basics.md" >}})
- [Learn how to install Mastodon]({{< relref "administration/installation.md" >}})
- [Learn how to write an app for Mastodon]({{< relref "api/guidelines.md" >}})

View File

@ -1,8 +0,0 @@
---
title: Installation
menu:
docs:
identifier: installation-dev
parent: development
weight: 1
---

View File

@ -1,13 +1,17 @@
{{ define "title"}} Mastodon documentation {{end}} {{ define "title"}} Mastodon documentation {{end}}
{{ define "main" }} {{ define "main" }}
<h1>Mastodon documentation</h1> <h1>{{ .Title }}</h1>
<div class="e-content"> <div class="e-content">
<p>Welcome to the Mastodon documentation!</p> {{.Content}}
<p>Mastodon is a <strong>free, open-source social network server</strong> based on <strong>open web protocols</strong> like ActivityPub and OStatus. The social focus of the project is a viable decentralized alternative to commercial social media silos that returns the control of the content distribution channels to the people. The technical focus of the project is a good user interface, a clean REST API for 3rd party apps and robust anti-abuse tools.</p> <p><i class="fas fa-language"></i> <strong>Available languages:</strong></p>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/IPSbNdBmWKE" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> <ul>
{{ range $.Site.Home.AllTranslations }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
</div> </div>
{{ end }} {{ end }}

View File

@ -12,3 +12,5 @@
<p class="legal"><a href='https://source.joinmastodon.org/mastodon/docs/tree/master/content/{{.Lang}}/{{.File.Path}}'>View source</a> · <a href='https://creativecommons.org/licenses/by-sa/4.0/'>CC BY-SA 4.0</a> · <a href='https://joinmastodon.org/imprint'>Imprint</a></p> <p class="legal"><a href='https://source.joinmastodon.org/mastodon/docs/tree/master/content/{{.Lang}}/{{.File.Path}}'>View source</a> · <a href='https://creativecommons.org/licenses/by-sa/4.0/'>CC BY-SA 4.0</a> · <a href='https://joinmastodon.org/imprint'>Imprint</a></p>
</footer> </footer>
<script async src="/site.js"></script>

View File

@ -8,15 +8,15 @@
<ul> <ul>
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.Menus.docs }} {{ range .Site.Menus.docs.ByWeight }}
{{ if .HasChildren }} {{ if .HasChildren }}
<li> <li>
<a href="#" class="{{ if $currentPage.HasMenuCurrent "docs" . }}active{{ end }}"> <a href="javascript:void(0)" class="menu-item{{ if $currentPage.HasMenuCurrent "docs" . }} active{{ end }}">
{{ .Pre }} {{ .Pre }}
<span>{{ .Name }}</span> <span>{{ .Name }}</span>
</a> </a>
<ul class="sub-menu"> <ul class="sub-menu{{ if $currentPage.HasMenuCurrent "docs" . }}{{else}} collapsed{{ end }}">
{{ range .Children }} {{ range .Children }}
<li> <li>
<a href="{{ .URL }}" class="{{ if $currentPage.IsMenuCurrent "docs" . }}active{{ end }}">{{ .Name }}</a> <a href="{{ .URL }}" class="{{ if $currentPage.IsMenuCurrent "docs" . }}active{{ end }}">{{ .Name }}</a>

19
static/site.js Normal file
View File

@ -0,0 +1,19 @@
(function () {
document.addEventListener('DOMContentLoaded', function () {
var menuLinks = document.getElementsByClassName('menu-item');
for (var i = 0; i < menuLinks.length; i++) {
menuLinks[i].addEventListener('click', toggleSubMenu, false);
}
function toggleSubMenu () {
var subMenus = document.getElementsByClassName('sub-menu');
for (var i = 0; i < subMenus.length; i++) {
subMenus[i].classList.add('collapsed');
}
this.parentNode.querySelector('.sub-menu').classList.remove('collapsed');
}
});
})();

View File

@ -106,6 +106,8 @@ body {
padding-bottom: 26px; } padding-bottom: 26px; }
.sidebar .sub-menu a.active { .sidebar .sub-menu a.active {
color: #2b90d9; } color: #2b90d9; }
.sidebar .sub-menu.collapsed {
display: none; }
.footer { .footer {
padding-bottom: 30px; } padding-bottom: 30px; }
@ -289,7 +291,8 @@ main code {
main pre code { main pre code {
background: transparent; background: transparent;
padding: 0; } padding: 0; }
main .mastodon-embed { main .mastodon-embed,
main iframe {
width: 100%; width: 100%;
display: block; display: block;
margin: 0 auto; margin: 0 auto;

File diff suppressed because one or more lines are too long

View File

@ -151,6 +151,10 @@ body {
a.active { a.active {
color: $vibrant; color: $vibrant;
} }
&.collapsed {
display: none;
}
} }
} }
@ -407,7 +411,8 @@ main {
padding: 0; padding: 0;
} }
.mastodon-embed { .mastodon-embed,
iframe {
width: 100%; width: 100%;
display: block; display: block;
margin: 0 auto; margin: 0 auto;