diff --git a/layouts/home.html b/layouts/home.html index b2e137af6..7ea6c94b3 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -1,5 +1,16 @@ {{ define "main" }} -{{ with .Content }} -{{ . }} + {{ if not .Site.Params.homePage -}} + {{ with .Content }} + {{ . }} + {{ end }} + {{ else -}} + {{ with .Site.Params.homePage -}} + + +
+ + + + {{ end -}} + {{ end -}} {{ end }} -{{ end }} \ No newline at end of file diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 3b04821b7..f7cd1758f 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -11,7 +11,11 @@ {{- /**/ -}} {{- 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 -}} @@ -63,4 +67,4 @@ {{ partial "search-input.html" . }} - \ No newline at end of file + diff --git a/userguide/content/en/docs/adding-content/content.md b/userguide/content/en/docs/adding-content/content.md index 9c5d60505..00c50434d 100644 --- a/userguide/content/en/docs/adding-content/content.md +++ b/userguide/content/en/docs/adding-content/content.md @@ -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). diff --git a/userguide/content/en/docs/adding-content/iconsimages.md b/userguide/content/en/docs/adding-content/iconsimages.md index 8feed7501..fa6e5fce1 100644 --- a/userguide/content/en/docs/adding-content/iconsimages.md +++ b/userguide/content/en/docs/adding-content/iconsimages.md @@ -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: @@ -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][]. diff --git a/userguide/hugo.yaml b/userguide/hugo.yaml index fd0039c1d..fe9e2316d 100644 --- a/userguide/hugo.yaml +++ b/userguide/hugo.yaml @@ -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