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 more configuration ability #1614

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
17 changes: 14 additions & 3 deletions layouts/home.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{{ define "main" }}
{{ with .Content }}
{{ . }}
{{ if not .Site.Params.homePage -}}
{{ with .Content }}
{{ . }}
{{ end }}
{{ else -}}
{{ with .Site.Params.homePage -}}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0;url={{.}}" />
</head>
</html>
{{ end -}}
{{ end -}}
{{ end }}
{{ end }}
8 changes: 6 additions & 2 deletions layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
{{- /**/ -}}
<span class="navbar-brand__logo navbar-logo">
{{- if ne .Site.Params.ui.navbar_logo false -}}
{{ with resources.Get "icons/logo.svg" -}}
{{ $logo := "icons/logo.svg" }}
{{ with .Site.Params.ui.navbar_logo }}
{{ $logo = . }}
{{ end }}
{{ with resources.Get $logo -}}
{{ ( . | minify).Content | safeHTML -}}
{{ end -}}
{{ end -}}
Expand Down Expand Up @@ -63,4 +67,4 @@
{{ partial "search-input.html" . }}
</div>
</div>
</nav>
</nav>
23 changes: 23 additions & 0 deletions userguide/content/en/docs/adding-content/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ Because most technical documentation sites have different sections for different

It also provides a [default "landing page" type of template](https://github.com/google/docsy/tree/main/layouts/_default) with the site header and footer, but no left nav, that you can use for any other section. In this site and our example site it's used for the site [home page](/) and the [About](/about/) page.

If you want to bypass the default home page, you can override the default by setting `params.homePage` to one of the sections.
for example:

{{< tabpane >}}
{{< tab header="Configuration file:" disabled=true />}}
{{< tab header="hugo.toml" lang="toml" >}}
[params]
homePage = "/docs"
{{< /tab >}}
{{< tab header="hugo.yaml" lang="yaml" >}}
params:
homePage = "/docs"
{{< /tab >}}
{{< tab header="hugo.json" lang="json" >}}
{
"params": {
"homePage": "/docs",
}
}
{{< /tab >}}
{{< /tabpane >}}


Each top-level **section** in your site corresponds to a **directory** in your site content root. Hugo automatically applies the appropriate **template** for that section, depending on which folder the content is in. For example, this page is in the `docs` subdirectory of the site's content root directory `content/en/`, so Hugo automatically applies the `docs` template. You can override this by explicitly specifying a template or content type for a particular page.

If you've copied the example site, you already have appropriately named top-level section directories for using Docsy's templates, each with an index page ( `_index.md` or `index.html`) page for users to land on. These top-level sections also appear in the example site's [top-level menu](/docs/adding-content/navigation/#top-level-menu).
Expand Down
21 changes: 19 additions & 2 deletions userguide/content/en/docs/adding-content/iconsimages.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ description: Add and customize logos, icons, and images in your project.
## Add your logo

By default, Docsy shows a site logo at the start of the navbar, that is, at the
extreme left. Place your project's SVG logo in `assets/icons/logo.svg`. This
overrides the default Docsy logo in the theme.
extreme left. You may either place your project's SVG logo in `assets/icons/logo.svg` or define a custom path under the
`assets/` folder. This overrides the default Docsy logo in the theme.

If you don't want a logo to appear in the navbar, then set site parameter `navbar_logo`
to `false` in your project's config:
Expand Down Expand Up @@ -37,6 +37,23 @@ params:
{{< /tab >}}
{{< /tabpane >}}

Alternatively, if you want to override the default `assets/icons/logo.svg` location, then set `params.ui.navbar_logo` to the desired path in your project's config:

{{< tabpane >}}
{{< tab header="Configuration file:" disabled=true />}}
{{< tab header="hugo.toml" lang="toml" >}}
navbar_logo = "/img/myLogo.svg"
{{< /tab >}}
{{< tab header="hugo.yaml" lang="yaml" >}}
navbar_logo: "/img/myLogo.svg"
{{< /tab >}}
{{< tab header="hugo.json" lang="json" >}}
{
"navbar_logo": "/img/myLogo.svg"
}
{{< /tab >}}
{{< /tabpane >}}

For information about styling your logo, see [Styling your project logo and
name][].

Expand Down
2 changes: 2 additions & 0 deletions userguide/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ markup:
style: tango

params:
# homePage: /blog If set, this redirects from the default home page to use one of the content sub-directories
copyright:
authors: >-
Docsy Authors |
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0) |
from_year: 2018

privacy_policy: https://policies.google.com/privacy
version_menu: Releases
archived_version: false
Expand Down