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

WIP - taxonomy support #272 #324 #539

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
7254c53
changes required for tagging
q5sys Aug 13, 2020
ecfc6ef
Delete tags.html
q5sys Aug 13, 2020
b2e70ca
code cleanup
q5sys Aug 13, 2020
5bc80d7
code cleanup
q5sys Aug 13, 2020
6b927b8
add tag cloud
q5sys Nov 11, 2020
99efb75
update toc file
q5sys Nov 11, 2020
9344e63
update docs
q5sys Nov 11, 2020
25aca3c
add tags.html
q5sys Nov 11, 2020
419edb1
Update summary.html
q5sys Nov 11, 2020
57a9c5b
Update config.toml
q5sys Nov 11, 2020
6b53d12
Update site-guidance.md
q5sys Nov 11, 2020
79f325e
add screenshots
q5sys Nov 11, 2020
e8e4908
Update site-guidance.md
q5sys Nov 11, 2020
6361d91
Update _index.md
q5sys Nov 11, 2020
b6a63c3
Update _index.md
q5sys Nov 11, 2020
a10ebf8
Update config.toml
q5sys Nov 11, 2020
adde333
Update config.toml
q5sys Nov 11, 2020
7acec37
Update _index.md
q5sys Nov 11, 2020
32e7a19
Update site-guidance.md
q5sys Nov 11, 2020
63ddc3e
Update script as described in the review comments
marcelbaumann Dec 12, 2020
d55cec7
Update tags.html
marcelbaumann Dec 12, 2020
fa881dd
Merge pull request #1 from marcelbaumann/patch-1
q5sys Dec 13, 2020
ec00013
Merge pull request #2 from marcelbaumann/patch-2
q5sys Dec 13, 2020
672856c
Merge branch 'master' into master
q5sys Dec 14, 2020
c2a226e
updating HUGO_VERSION
q5sys Dec 14, 2020
6c8380e
bring dev-taxonomy up to date
narrenfrei Apr 18, 2021
e14953a
Merge branch 'master' of https://github.com/google/docsy into dev-tax…
narrenfrei May 2, 2021
87c47a4
changes required for tagging
q5sys Aug 13, 2020
3c8ddf2
add tag cloud
q5sys Nov 11, 2020
b1d1e28
update toc file
q5sys Nov 11, 2020
7949445
update docs
q5sys Nov 11, 2020
5b20edb
code cleanup
q5sys Aug 13, 2020
ba3dae1
code cleanup
q5sys Aug 13, 2020
50183fc
Update summary.html
q5sys Nov 11, 2020
e2978ff
Update config.toml
q5sys Nov 11, 2020
421832a
Update site-guidance.md
q5sys Nov 11, 2020
0384022
add screenshots
q5sys Nov 11, 2020
4bed508
Update site-guidance.md
q5sys Nov 11, 2020
f5e737b
Update _index.md
q5sys Nov 11, 2020
c130d4d
Update config.toml
q5sys Nov 11, 2020
c791b63
Update config.toml
q5sys Nov 11, 2020
4805e6a
Update _index.md
q5sys Nov 11, 2020
d5cf903
Update site-guidance.md
q5sys Nov 11, 2020
872f696
Update script as described in the review comments
marcelbaumann Dec 12, 2020
b993581
Update tags.html
marcelbaumann Dec 12, 2020
26e8e1b
Merge branch 'dev-taxonomy' of https://github.com/narrenfrei/docsy in…
narrenfrei May 2, 2021
b575523
Added test content for development
narrenfrei May 2, 2021
e8c83ea
testing for dev taxonomies
narrenfrei May 5, 2021
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
2 changes: 1 addition & 1 deletion assets/vendor/Font-Awesome
Submodule Font-Awesome updated 3407 files
29 changes: 15 additions & 14 deletions layouts/_default/content.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<div class="td-content">
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
{{ partial "reading-time.html" . }}
{{ partial "article_meta.html" . }}
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
{{ partial "reading-time.html" . }}
{{ end }}
{{ .Content }}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
{{ partial "feedback.html" .Site.Params.ui.feedback }}
<br />
{{ end }}
{{ if (.Site.Params.DisqusShortname) }}
<br />
{{ partial "disqus-comment.html" . }}
{{ end }}
<div class="text-muted mt-5 pt-3 border-top">{{ partial "page-meta-lastmod.html" . }}</div>
{{ .Content }}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
{{ partial "feedback.html" .Site.Params.ui.feedback }}
<br />
{{ end }}
{{ if (.Site.Params.DisqusShortname) }}
<br />
{{ partial "disqus-comment.html" . }}
{{ end }}
<div class="text-muted mt-5 pt-3 border-top">{{ partial "page-meta-lastmod.html" . }}</div>
</div>
8 changes: 8 additions & 0 deletions layouts/_default/taxonomy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{ define "main" }}
<section>
{{ range .Pages }}
{{ partial "summary.html" . }}
{{ end }}
</section>
{{ end }}

13 changes: 13 additions & 0 deletions layouts/_default/terms.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{ define "main" }}
<section>
<header>
<h4>List of article {{ .Section }}</h4>
</header>
</section>
{{ range $key, $value := .Data.Terms }}
{{ $postCount := len $value.Pages }}
<a href="{{ "/" | relLangURL }}{{ $.Data.Plural | urlize }}/{{ $key | urlize }}">
<h5>{{ $key }} :
<span class="badge badge-light">{{ $postCount }}</span></h5></a>
{{ end }}
{{ end }}
30 changes: 30 additions & 0 deletions layouts/docs/list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
{{ define "main" }}
<!-- <script>console.log({{ .Params }});</script>
<script>console.log({{ .Site.Taxonomies }});</script> -->

<section>
<ul id="all-taxonomies">
{{ range $taxonomy_term, $taxonomy := .Site.Taxonomies }}
{{ with $.Site.GetPage (printf "/%s" $taxonomy_term) }}
<li><a href="{{ .Permalink }}">{{ $taxonomy_term }}</a>
<ul>
{{ range $key, $value := $taxonomy }}
<li>{{ $key }}

<!-- <script>console.log({{ $taxonomy.Plural }});</script> -->
<ul>
{{ range $value.Pages }}
<li hugo-nav="{{ .RelPermalink}}">
<a href="{{ .Permalink}}">{{ .LinkTitle }}</a>
</li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
</li>
{{ end }}
{{ end }}
</ul>
</section>

<div class="td-content">
{{ partial "article_meta.html" . }}
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/article_meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<header class="article-meta clearfix">
{{ partial "article_tags.html" . }}
</header>
7 changes: 7 additions & 0 deletions layouts/partials/article_tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ with (.GetTerms "tags")}}
<div class="article-tags">
{{ range . }}
<span class="badge badge-light fas fa-tag"><a class="article-tags-link" href="{{ .Permalink }}">{{ .Name }}</a></span>
{{ end }}
</div>
{{end}}
12 changes: 12 additions & 0 deletions layouts/partials/summary.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="pageinfo pageinfo-primary">
<div class = 'summary'>
<div class = 'summary_header'>
<h3 class = 'post_link'>
<a href='{{ .Permalink }}'>{{ .Title }}</a>
</h3>
{{ partial "article_meta.html" . }}
</div>
<p class = 'summary_section'>{{ .Summary | truncate 320 }}</p>
<a href='{{ .Permalink }}' class='excerpt_more button'>Read More</a>
</div>
</div>
47 changes: 47 additions & 0 deletions layouts/partials/tags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<hr>
{{ $taxo := "projects" }} <!-- Use the plural form here -->
<ul>
{{ range (.GetTerms $taxo) }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>

<hr>

<hr>
{{ $taxo := "tags" }} <!-- Use the plural form here -->
{{ with .Param $taxo }}
<p>Tags: {{ delimit . ", " }}</p>
{{ end }}

<hr>
{{ $taxo := "tags" }} <!-- Use the plural form here -->
{{ with .Param $taxo }}
<strong>Tag{{ if gt (len .) 1 }}s{{ end }}:</strong>
{{ range $index, $director := . }}
{{- if gt $index 0 }}, {{ end -}}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo $director) -}}
<a href="{{ .Permalink }}">{{ $director }}</a>
{{- end -}}
{{- end -}}
{{ end }}

<hr>
{{ if isset .Site.Taxonomies "tags" }}
{{ if not (eq (len .Site.Taxonomies.tags) 0) }}
<div class="tagslist">

<!-- <pre>{{ printf "%#v" .Site.Taxonomies.tags | jsonify }}</pre>
<pre> {{ .Site.Taxonomies.tags }} </pre>
<script>console.log({{ .Site.Taxonomies.Tags }});</script> -->

<p class="asidetitle">{{ .Site.Params.Strings.Tags | default "Tag Cloud" }}</p>
<ul class="clearfix">
{{ range $name, $items := .Site.Taxonomies.tags }}
<li><a href="{{ .Page.Permalink }}" title="{{ $name }}">{{ .Page.Title }}<sup>{{ len $items }}</sup></a></li>
{{ end }}
</ul>
</div>
{{ end }}
{{ end }}
<hr>
3 changes: 2 additions & 1 deletion layouts/partials/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
{{ . }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ partial "tags.html" . }}
10 changes: 9 additions & 1 deletion userguide/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ defaultContentLanguageInSubdir = false
# Useful when translating.
enableMissingTranslationPlaceholders = true

disableKinds = ["taxonomy", "taxonomyTerm"]
# disableKinds = ["taxonomy"]
[taxonomies]
tag = "tags"
category = "categories"
project = "projects"

[params.taxonomy]
taxonomyCloud = ["tags"]
taxonomyPageHeader = ["tags", "categories", "projects"]

# Highlighting config
pygmentsCodeFences = true
Expand Down
19 changes: 19 additions & 0 deletions userguide/content/en/docs/Best practices/site-guidance.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,22 @@ find and automatically link to your file named `filename.md`.
Note, however, that `ref` and `relref` links don't work with `_index` or `index` files (for example, this site's [content landing page](/docs/adding-content/)): you'll need to use regular Markdown links to section landing or other index pages. Specify these links relative to the site's root URL, for example: `/docs/adding-content/`.

[Learn more about linking](/docs/adding-content/content/#working-with-links).

## Tagging

An example of Tagging on a live site can be seen at the [TrueNAS Docs Site](https://www.truenas.com/docs/hub/).

Tagging is enabled on articles, but can be disabled by adding the line: `disableKinds = ["taxonomy", "taxonomyTerm"]` in config.toml.
To add tags to an article, add a 'tags:' line to the front matter on each article.
Example: `tags: ["tag1"]`
Multiple tags can be added separated by commas: `tags: ["tag1","tag2","tag3"]`

This will enable a list that will show ever article with that tag when someone clicks on it.

<img src="/images/tag-demo-2.PNG" width='700px'>
<br>

A Tag Cloud is available that will display all tags and numbers of each tag in the right sidebar. To enable the tag cloud, uncomment line 8 of toc.html in the partials subdirectory.

<img src="/images/tag-demo-1.PNG" width='700px'>
<br>
2 changes: 2 additions & 0 deletions userguide/content/en/docs/Examples/_index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: "Examples"
weight: 8
tags: ["examples"]
description: >
Some examples of Docsy in action!

---

One of the best ways to see what Docsy can do, and learn how to configure a site with it, is to see some real projects. In addition to our provided Docsy Example Project, there are several live sites already using the theme. Please add your own examples once you've got a production site up and running with Docsy!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: "Guidelines for Contribution to Docsy"
linkTitle: "Contribution Guidelines"
weight: 9
icon: fas fa-indent
tags: ["tag 1","tag 2","tag 4"]
projects: ["project 1","project 2","project 4"]
description: >
How to contribute to Docsy
---

Docsy is an open source project and we love getting patches and contributions to make Docsy and its docs even better.

## Contributing to Docsy

The Docsy theme itself lives in <https://github.com/google/docsy>.

### Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

### Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

### Previewing your changes

As Docsy is a theme rather than a site, you can't serve the theme directly to check your changes work. Instead use your updated local theme in a local copy of the Docsy example site (copy or make your changes in the `themes/docsy` directory) and [preview](/docs/deployment/) from there. Alternatively, clone the [Docsy theme repo](https://github.com/google/docsy) and test your changes in a local copy of this site, as described [below](#previewing-your-changes-locally).

### Community guidelines

This project follows
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).

### Creating issues

Alternatively, if there's something you'd like to see in Docsy (or if you've found something that isn't working the way you'd expect), but you're not sure how to fix it yourself, please create an [issue](https://github.com/google/docsy/issues).

## Contributing to these docs

This user guide is, like our example site, a Docsy site that uses the Hugo static site generator. We welcome updates to the docs!

We use [Netlify](https://www.netlify.com/) to manage the deployment of the site and provide previews of doc updates. The instructions here assume you're familiar with basic GitHub workflows.

### Quick start with Netlify

1. Fork the [Docsy repo](https://github.com/google/docsy) on GitHub: this site's files live in the `userguide` subdirectory.
1. Make your changes and send a pull request (PR).
1. If you're not yet ready for a review, add "WIP" to the PR name to indicate
it's a work in progress. (**Don't** add the Hugo property
"draft = true" to the page front matter, because that prevents the
auto-deployment of the content preview described in the next point.)
1. Wait for the automated PR workflow to do some checks. When it's ready,
you should see a comment like this: **deploy/netlify — Deploy preview ready!**
1. Click **Details** to the right of "Deploy preview ready" to see a preview
of your updates.
1. Continue updating your doc and pushing your changes until you're happy with
the content.
1. When you're ready for a review, add a comment to the PR, and remove any
"WIP" markers.

### Updating a single page

If you've just spotted something you'd like to change while using the docs, Docsy has a shortcut for you:

1. Click **Edit this page** in the top right hand corner of the page.
1. If you don't already have an up to date fork of the project repo, you are prompted to get one - click **Fork this repository and propose changes** or **Update your Fork** to get an up to date version of the project to edit. The appropriate page in your fork is displayed in edit mode.
1. Follow the rest of the [Quick start with Netlify](#quick-start-with-netlify) process above to make and preview your changes.


### Previewing your changes locally

If you want to run your own local Hugo server to preview your changes as you work:

1. Follow the instructions in [Getting started](/docs/getting-started) to install Hugo and any other tools you need.
1. Fork the [Docsy](https://github.com/google/docsy) repo into your own project, then create a local copy using `git clone`. Don’t forget to use `--recurse-submodules` or you won’t pull down some of the code you need to generate a working site.

```
git clone --recurse-submodules --depth 1 https://github.com/google/docsy.git
```

1. Change to the `userguide` directory and run the following Hugo command to build the site and start the Hugo server.
Note that you need the `themesDir` flag because the site files are inside the theme repo.

```
cd userguide
hugo server --themesDir ../..
```

By default your site will be available at http://localhost:1313/. Now that you're serving your site locally, Hugo will watch for changes to the content and automatically refresh your site.

1. Continue with the usual GitHub workflow to edit files, commit them, push the
changes up to your fork, and create a pull request.

### Creating an issue

If there's something you'd like to see in the docs, but you're not sure how to fix it yourself, please create an issue in [this repository](https://github.com/google/docsy). You can also create an issue about a specific page by clicking the **Create Issue** button in the top right hand corner of the page.


Loading