Skip to content

Commit

Permalink
Let sitename link back to document root just like the logo. (#1553)
Browse files Browse the repository at this point in the history
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
  • Loading branch information
fredrikekre and mortenpi authored Mar 28, 2021
1 parent b2bab81 commit 77e0f7e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

* ![Enhancement][badge-enhancement] `deploydocs` now throws an error if something goes wrong with the Git invocations used to deploy to `gh-pages`. ([#1529][github-1529])

* ![Enhancement][badge-enhancement] In the HTML output, the site name at the top of the sidebar now also links back to the main page of the documentation (just like the logo). ([#1553][github-1553])

* ![Bugfix][badge-bugfix] A bad `repo` argument to `deploydocs` containing a protocol now throws an error instead of being misinterpreted. ([#1531][github-1531], [#1533][github-1533])

* ![Bugfix][badge-bugfix] SVG images generated by `@example` blocks are now properly scaled to page width by URI-encoding the images, instead of directly embedding the SVG tags into the HTML. ([#1537][github-1537], [#1538][github-1538])
Expand Down Expand Up @@ -776,6 +778,7 @@
[github-1540]: https://github.com/JuliaDocs/Documenter.jl/pull/1540
[github-1549]: https://github.com/JuliaDocs/Documenter.jl/pull/1549
[github-1551]: https://github.com/JuliaDocs/Documenter.jl/pull/1551
[github-1553]: https://github.com/JuliaDocs/Documenter.jl/pull/1553
[github-1556]: https://github.com/JuliaDocs/Documenter.jl/issues/1556
[github-1557]: https://github.com/JuliaDocs/Documenter.jl/pull/1557

Expand Down
3 changes: 3 additions & 0 deletions assets/html/scss/documenter/layout/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
.docs-autofit {
max-width: $documenter-sidebar-title-width;
}
a, a:hover {
color: $documenter-sidebar-color;
}
}

// The version selector (optional). It is hidden by default, but can be toggled by JS
Expand Down
2 changes: 2 additions & 0 deletions assets/html/themes/documenter-dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions assets/html/themes/documenter-light.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -927,12 +927,13 @@ function render_sidebar(ctx, navnode)
src = get_url(ctx, navnode)
navmenu = nav[".docs-sidebar"]

# The logo and sitename will point to the first page in the navigation menu
href = navhref(ctx, first(ctx.doc.internal.navlist), navnode)

# Logo
logo = find_image_asset(ctx, "logo")
logo_dark = find_image_asset(ctx, "logo-dark")
if logo !== nothing
# the logo will point to the first page in the navigation menu
href = navhref(ctx, first(ctx.doc.internal.navlist), navnode)
alt = isempty(ctx.doc.user.sitename) ? "Logo" : "$(ctx.doc.user.sitename) logo"
logo_element = a[".docs-logo", :href => href]
if logo_dark === nothing
Expand All @@ -946,7 +947,7 @@ function render_sidebar(ctx, navnode)
# Sitename
if ctx.settings.sidebar_sitename
push!(navmenu.nodes, div[".docs-package-name"](
span[".docs-autofit"](ctx.doc.user.sitename)
span[".docs-autofit"](a[:href => href](ctx.doc.user.sitename))
))
end

Expand Down

0 comments on commit 77e0f7e

Please sign in to comment.