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 option to hide sitename in sidebar #1089

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ Default is `nothing`, in which case no canonical link is set.
**`assets`** can be used to include additional assets (JS, CSS, ICO etc. files). See below
for more information.

**`sidebar_sitename`** determines whether the site name is shown in the sidebar or not.
Setting it to `false` can be useful when the logo already contains the name of the package.
Defaults to `true`.

# Default and custom assets

Documenter copies all files under the source directory (e.g. `/docs/src/`) over
Expand Down Expand Up @@ -145,6 +149,7 @@ struct HTML <: Documenter.Writer
assets :: Vector{String}
analytics :: String
collapselevel :: Int
sidebar_sitename :: Bool

function HTML(;
prettyurls :: Bool = true,
Expand All @@ -154,9 +159,11 @@ struct HTML <: Documenter.Writer
assets :: Vector{String} = String[],
analytics :: String = "",
collapselevel :: Integer = 2,
sidebar_sitename :: Bool = true,
)
collapselevel >= 1 || thrown(ArgumentError("collapselevel must be >= 1"))
new(prettyurls, disable_git, edit_branch, canonical, assets, analytics, collapselevel)
new(prettyurls, disable_git, edit_branch, canonical, assets, analytics,
collapselevel, sidebar_sitename)
end
end

Expand Down Expand Up @@ -539,9 +546,11 @@ function render_sidebar(ctx, navnode)
push!(navmenu.nodes, logo_element)
end
# Sitename
push!(navmenu.nodes, div[".docs-package-name"](
span[".docs-autofit"](ctx.doc.user.sitename)
))
if ctx.settings.sidebar_sitename
push!(navmenu.nodes, div[".docs-package-name"](
span[".docs-autofit"](ctx.doc.user.sitename)
))
end

# Search box
push!(navmenu.nodes,
Expand Down