From c60791c3fbcc46d1703a46318459200272b96796 Mon Sep 17 00:00:00 2001 From: Bryan Finster Date: Fri, 7 Jul 2023 07:18:02 -0500 Subject: [PATCH 1/5] fix: Make homepage configurable --- layouts/home.html | 17 +++++++++++--- .../content/en/docs/adding-content/content.md | 23 +++++++++++++++++++ userguide/hugo.yaml | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/layouts/home.html b/layouts/home.html index b2e137af6f..6b20ddcc92 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/userguide/content/en/docs/adding-content/content.md b/userguide/content/en/docs/adding-content/content.md index 88c070826a..db64e01eaf 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/hugo.yaml b/userguide/hugo.yaml index 725af1c9e0..ff9e7ba159 100644 --- a/userguide/hugo.yaml +++ b/userguide/hugo.yaml @@ -51,6 +51,7 @@ markup: params: copyright: The Docsy Authors + # homePage: /blog If set, this redirects from the default home page to use one of the content sub-directories privacy_policy: https://policies.google.com/privacy version_menu: Releases archived_version: false From 17ba7d5663ece3b5b18f584af1a01d905ed6b132 Mon Sep 17 00:00:00 2001 From: Bryan Finster Date: Fri, 7 Jul 2023 08:17:45 -0500 Subject: [PATCH 2/5] Make logo location configurable --- layouts/partials/navbar.html | 8 +++++-- .../en/docs/adding-content/iconsimages.md | 21 +++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 3b04821b76..f7cd1758f7 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -11,7 +11,11 @@ {{- /**/ -}}