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

Make heading level which is shown in right sidebar configurable #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ These are theme-specific settings and can be set in a settings file (in addition
- `SiteTitle`: The title of the site. This should be defined regardless of whether `Logo` is because it's used for the page title, alt attributes, etc.
- `Logo`: The logo file to use in the navigation bar (include a leading slash if providing a relative path). If not provided, the `SiteTitle` will be used.
- `EditRoot`: The root link to use for editing pages, usually set to a value like `https://github.com/org/repo/edit/develop/input` (do not use a trailing slash).
- `RightSidebarHeadingLevel`: Heading level which should be shown in the right sidebar. By default heading level 1 is shown.

### Colors

Expand Down
5 changes: 5 additions & 0 deletions SiteKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@ public static class SiteKeys
/// A Google Fonts (or other) URL for use in a <c>link</c> element in the header.
/// </summary>
public const string FontLink = nameof(FontLink);

/// <summary>
/// Heading level which should be shown in the right sidebar.
/// </summary>
public const string RightSidebarHeadingLevel = nameof(RightSidebarHeadingLevel);
}
}
2 changes: 1 addition & 1 deletion input/Shared/_RightSidebar.cshtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@{
IReadOnlyList<IDocument> headings = Document
.GetDocumentList(Keys.Headings)
?.Where(x => x.GetInt(Keys.Level) == 1)
?.Where(x => x.GetInt(Keys.Level) == Document.GetInt(SiteKeys.RightSidebarHeadingLevel, 1))
.ToList();
string editLink = Document.ContainsKey(SiteKeys.EditLink)
? Document.GetString(SiteKeys.EditLink)
Expand Down