diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..23dbfca34f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# Editor configuration, see https://editorconfig.org + +root = true + +# All files +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/README.md b/README.md index 89dde4e5ce..48b72d0e45 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Docsy +# Docsy Docsy is a [Hugo](https://gohugo.io/) theme for technical documentation sets, providing simple navigation, site structure, and more. @@ -22,12 +22,12 @@ The following are basic prerequisites for using Docsy in your site: ## Example and usage -You can find an example project that uses Docsy in the [Docsy Example Project repo](https://github.com/google/docsy-example). The Docsy Example Project is hosted at [https://example.docsy.dev/](https://example.docsy.dev/). +You can find an example project that uses Docsy in the [Docsy Example Project repo](https://github.com/google/docsy-example).The Docsy Example Project is hosted at [https://example.docsy.dev/](https://example.docsy.dev/). To use the Docsy theme for your own site: - (Recommended) Copy the [example project](https://github.com/google/docsy-example), - which includes the Docsy theme as a submodule. + which includes the Docsy theme as a submodule. You can customize this pre-configured basic site into your own Docsy themed site. [Learn more...](https://github.com/google/docsy-example) @@ -47,4 +47,13 @@ cd docsy/userguide/ hugo server --themesDir ../.. ``` -Note that you need the `themesDir` flag when running Hugo because the site files are inside the theme repo. +Note: you need the `themesDir` flag when running Hugo because the site files are inside the theme repo. + +## Contributing ![GitHub](https://img.shields.io/github/contributors/google/docsy) + +Please read [CONTRIBUTING.md](https://github.com/google/docsy/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. +See also the list of [contributors](https://github.com/google/docsy/graphs/contributors) who participated in this project. + +## License ![GitHub](https://img.shields.io/github/license/google/docsy) + +This project is licensed under the Apache License 2.0 - see the [LICENSE.md](https://github.com/google/docsy/blob/master/LICENSE) file for details diff --git a/assets/js/offline-search.js b/assets/js/offline-search.js index 9fb5afea3b..527ef47332 100644 --- a/assets/js/offline-search.js +++ b/assets/js/offline-search.js @@ -98,7 +98,10 @@ }); }); }) - .slice(0, 10); + .slice( + 0, + $targetSearchInput.data('offline-search-max-results') + ); // // Make result html @@ -143,27 +146,30 @@ ); } else { results.forEach((r) => { - const $cardHeader = $('
').addClass('card-header'); const doc = resultDetails.get(r.ref); const href = $searchInput.data('offline-search-base-href') + r.ref.replace(/^\//, ''); - $cardHeader.append( - $('').attr('href', href).text(doc.title) + const $entry = $('
').addClass('mt-4'); + + $entry.append( + $('').addClass('d-block text-muted').text(r.ref) ); - const $cardBody = $('
').addClass('card-body'); - $cardBody.append( - $('

') - .addClass('card-text text-muted') - .text(doc.excerpt) + $entry.append( + $('') + .addClass('d-block') + .css({ + fontSize: '1.2rem', + }) + .attr('href', href) + .text(doc.title) ); - const $card = $('

').addClass('card'); - $card.append($cardHeader).append($cardBody); + $entry.append($('

').text(doc.excerpt)); - $searchResultBody.append($card); + $searchResultBody.append($entry); }); } diff --git a/assets/json/offline-search-index.json b/assets/json/offline-search-index.json index 0ec4084350..17707a8d39 100644 --- a/assets/json/offline-search-index.json +++ b/assets/json/offline-search-index.json @@ -1,5 +1,6 @@ {{- $.Scratch.Add "offline-search-index" slice -}} {{- range where .Site.AllPages ".Params.exclude_search" "!=" true -}} -{{- $.Scratch.Add "offline-search-index" (dict "title" .Title "ref" .RelPermalink "body" .Plain "excerpt" (.Summary | truncate 100)) -}} +{{/* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */}} +{{- $.Scratch.Add "offline-search-index" (dict "title" .Title "ref" .RelPermalink "body" (.Plain | htmlUnescape) "excerpt" (.Plain | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)) -}} {{- end -}} {{- $.Scratch.Get "offline-search-index" | jsonify -}} diff --git a/assets/scss/_boxes.scss b/assets/scss/_boxes.scss index 7fa99fcfef..7049d142d3 100644 --- a/assets/scss/_boxes.scss +++ b/assets/scss/_boxes.scss @@ -34,7 +34,7 @@ @include link-variant("#{$parent}--#{$color-name} p > a", $link-color, $link-hover-color, false); @if $enable-gradients { - @include bg-gradient-variant("#{$parent}--1#{$color-name}#{$parent}--gradient", $color-value); + @include bg-gradient-variant("#{$parent}--1#{$color-name}#{$parent}--gradient", $color-value,true); } } diff --git a/assets/scss/_code.scss b/assets/scss/_code.scss index fa2974393d..7f2193a887 100644 --- a/assets/scss/_code.scss +++ b/assets/scss/_code.scss @@ -4,18 +4,13 @@ // Highlighted code. .highlight { @extend .card; - + margin: 2rem 0; - padding: 1rem; - background-color: $gray-100; - - pre, div { - background-color: inherit !important; - } - + padding: 0; + pre { margin: 0; - padding: 0; + padding: 1rem; } } @@ -43,6 +38,7 @@ > code { + background-color: inherit !important; padding: 0; margin: 0; font-size: 100%; diff --git a/assets/scss/_sidebar-tree.scss b/assets/scss/_sidebar-tree.scss index 3eef1c4b01..4df0d32f8e 100644 --- a/assets/scss/_sidebar-tree.scss +++ b/assets/scss/_sidebar-tree.scss @@ -82,6 +82,11 @@ padding: 0 0 1rem; } } + + & > .td-sidebar-nav__section { + padding-top: .5rem; + padding-left: 1.5rem; + } } .td-sidebar { @@ -129,4 +134,13 @@ width: 100%; } } + + #content-desktop {display: block;} + #content-mobile {display: none;} + + @include media-breakpoint-down(md) { + + #content-desktop {display: none;} + #content-mobile {display: block;} + } } \ No newline at end of file diff --git a/assets/scss/support/_mixins.scss b/assets/scss/support/_mixins.scss index 27dfec528c..b0d7bdf055 100644 --- a/assets/scss/support/_mixins.scss +++ b/assets/scss/support/_mixins.scss @@ -1,6 +1,6 @@ // Some simple mixins. -@mixin bg-gradient-variant($parent, $color) { +@mixin bg-gradient-variant($parent, $color,$ignore-warning: false) { #{$parent} { background: $color linear-gradient(180deg, mix($body-bg, $color, 15%), $color) repeat-x !important; } diff --git a/assets/vendor/Font-Awesome b/assets/vendor/Font-Awesome index 538a5bc4cf..951a0d011f 160000 --- a/assets/vendor/Font-Awesome +++ b/assets/vendor/Font-Awesome @@ -1 +1 @@ -Subproject commit 538a5bc4cf7989821d052e3ff919e2bead07021c +Subproject commit 951a0d011f8c832991750c16136f8e260efa60b5 diff --git a/assets/vendor/bootstrap b/assets/vendor/bootstrap index 3b55873438..7a6da5e3e7 160000 --- a/assets/vendor/bootstrap +++ b/assets/vendor/bootstrap @@ -1 +1 @@ -Subproject commit 3b558734382ce58b51e5fc676453bfd53bba9201 +Subproject commit 7a6da5e3e7ad7c749dde806546a35d4d4259d965 diff --git a/i18n/es.toml b/i18n/es.toml new file mode 100644 index 0000000000..d148c95ff1 --- /dev/null +++ b/i18n/es.toml @@ -0,0 +1,43 @@ + + +# UI strings. Botones y similares. + +[ui_pager_prev] +other = "Previo" + +[ui_pager_next] +other = "Siguiente" + +[ui_read_more] +other = "Contiuar leyendo" + +[ui_search] +other = "Buscar" + +# Used in sentences such as "Posted in News" +[ui_in] +other = "en" + +# Footer text +[footer_all_rights_reserved] +other = "Derechos reservados" + +[footer_privacy_policy] +other = "Política de privacidad" + + +# Post (blog, articles etc.) +[post_byline_by] +other = "Por" +[post_created] +other = "Creado" +[post_last_mod] +other = "Última modificación" +[post_edit_this] +other = "Editar esta página" +[post_create_issue] +other = "Notificar una incidencia con la documentanción" +[post_create_project_issue] +other = "Notificar una incidencia en un proyecto" +[post_posts_in] +other = "Añadir entrada" diff --git a/i18n/fr.toml b/i18n/fr.toml new file mode 100644 index 0000000000..8d9f65ed36 --- /dev/null +++ b/i18n/fr.toml @@ -0,0 +1,43 @@ + + +# UI strings. Buttons and similar. + +[ui_pager_prev] +other = "Précédent" + +[ui_pager_next] +other = "Suivant" + +[ui_read_more] +other = "Lire plus" + +[ui_search] +other = "Rechercher ce site…" + +# Used in sentences such as "Posted in News" +[ui_in] +other = "dans" + +# Footer text +[footer_all_rights_reserved] +other = "Tous droits résérvés" + +[footer_privacy_policy] +other = "Politique de confidentialité" + + +# Post (blog, articles etc.) +[post_byline_by] +other = "Par" +[post_created] +other = "Crée" +[post_last_mod] +other = "Dernière modification" +[post_edit_this] +other = "Modifier cette page" +[post_create_issue] +other = "Créer un problème dans la documentation" +[post_create_project_issue] +other = "Créer un problème dans le projet" +[post_posts_in] +other = "Messages dans" diff --git a/i18n/hu.toml b/i18n/hu.toml new file mode 100644 index 0000000000..832bc13787 --- /dev/null +++ b/i18n/hu.toml @@ -0,0 +1,47 @@ + + +# UI strings. Buttons and similar. + +[ui_pager_prev] +other = "Előző" + +[ui_pager_next] +other = "Következő" + +[ui_read_more] +other = "További olvasnivaló" + +[ui_search] +other = "Keresés ezen az oldalon…" + +# Used in sentences such as "Posted in News" +# TODO: this structure will not work in Hungarian +# so I left it as is +[ui_in] +other = "in" + +# Footer text +[footer_all_rights_reserved] +other = "Minden jog fenntartva" + +[footer_privacy_policy] +other = "Adatvédelmi szabályzat" + + +# Post (blog, articles etc.) +[post_byline_by] +other = "Készítette" +[post_created] +other = "Elkészítve" +[post_last_mod] +other = "Utolsó módosítás" +[post_edit_this] +other = "Oldal szerkesztése" +[post_create_issue] +other = "Dokumentáció issue létrehozása" +[post_create_project_issue] +other = "Projekt issue létrehozása" +# TODO: this structure will not work in Hungarian +# so I left it as is +[post_posts_in] +other = "Posts in" diff --git a/i18n/ru.toml b/i18n/ru.toml new file mode 100644 index 0000000000..95fe77169a --- /dev/null +++ b/i18n/ru.toml @@ -0,0 +1,43 @@ + + +# UI strings. Buttons and similar. + +[ui_pager_prev] +other = "Предыдущая" + +[ui_pager_next] +other = "Следующая" + +[ui_read_more] +other = "Подробнее" + +[ui_search] +other = "Поиск по сайту…" + +# Used in sentences such as "Posted in News" +[ui_in] +other = "в" + +# Footer text +[footer_all_rights_reserved] +other = "Все права защищены" + +[footer_privacy_policy] +other = "Политика конфиденциальности" + + +# Post (blog, articles etc.) +[post_byline_by] +other = "Автор" +[post_created] +other = "Создано" +[post_last_mod] +other = "Изменено" +[post_edit_this] +other = "Отредактировать страницу" +[post_create_issue] +other = "Предложить изменения документации" +[post_create_project_issue] +other = "Предложить доработки по проекту" +[post_posts_in] +other = "Публикации в" diff --git a/layouts/_default/content.html b/layouts/_default/content.html index 2aa4e6b1c4..f6f47475ad 100644 --- a/layouts/_default/content.html +++ b/layouts/_default/content.html @@ -9,7 +9,7 @@

{{ .Title }}

{{ partial "feedback.html" .Site.Params.ui.feedback }}
{{ end }} - {{ if (.Site.DisqusShortname) }} + {{ if (.Site.Params.DisqusShortname) }}
{{ partial "disqus-comment.html" . }} {{ end }} diff --git a/layouts/blog/content.html b/layouts/blog/content.html index 7193b191d7..cd3d4d04bf 100644 --- a/layouts/blog/content.html +++ b/layouts/blog/content.html @@ -5,8 +5,11 @@

{{ .Title }}

{{ with .Params.author }}{{ T "post_byline_by" }} {{ . | markdownify }} |{{ end}}
+ {{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }} + {{ partial "reading-time.html" . }} + {{ end }} {{ .Content }} - {{ if (.Site.DisqusShortname) }} + {{ if (.Site.Params.DisqusShortname) }}
{{ partial "disqus-comment.html" . }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 1fabd3bae7..2d4571d976 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -32,7 +32,7 @@
    {{ range . }}
  • - +
  • diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a5493c924a..9d4a776fb4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -20,8 +20,8 @@ {{ end }} {{ partialCached "head-css.html" . "asdf" }} {{ if .Site.Params.offlineSearch }} {{end}} -{{ partial "hooks/head-end.html" . }} \ No newline at end of file +{{ partial "hooks/head-end.html" . }} diff --git a/layouts/partials/search-input.html b/layouts/partials/search-input.html index 6e442eb9af..76d6422516 100644 --- a/layouts/partials/search-input.html +++ b/layouts/partials/search-input.html @@ -9,7 +9,7 @@ placeholder=" {{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off" - {{/* + {{/* The data attribute name of the json file URL must end with `src` since Hugo's absurlreplacer requires `src`, `href`, `action` or `srcset` suffix for the attribute name. If the absurlreplacer is not applied, the URL will start with `/`. @@ -18,5 +18,6 @@ */}} data-offline-search-index-json-src="{{ $offlineSearchIndexFingerprint.RelPermalink }}" data-offline-search-base-href="/" + data-offline-search-max-results="{{ .Site.Params.offlineSearchMaxResults | default 10 }}" > {{ end }} diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html index a3eeb2a45e..8f3392e80d 100644 --- a/layouts/partials/sidebar-tree.html +++ b/layouts/partials/sidebar-tree.html @@ -7,8 +7,17 @@ + {{ else }} +
    + +
    +
    {{ end }} -