-
Notifications
You must be signed in to change notification settings - Fork 8
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 PrimaryNav
feature
#604
Conversation
edd2fc9
to
745486b
Compare
.github/workflows/preview-build.yml
Outdated
@@ -133,23 +133,21 @@ jobs: | |||
- name: Build documentation | |||
if: github.repository != 'elastic/docs-builder' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_modified == 'true' && github.event_name == 'merge_group')) | |||
uses: elastic/docs-builder@main | |||
id: docs-build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a merge went bad here? we want to keep these changes from main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, something went wrong. Thank you for bringing this to my attention!
actions/generator/action.yml
Outdated
@@ -0,0 +1,16 @@ | |||
name: 'Documentation Generator' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise this should be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actions/update-reference-index/action.yml should be undeleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs-builder.sln
Outdated
@@ -60,17 +60,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "validate-inbound-local", "v | |||
actions\validate-inbound-local\action.yml = actions\validate-inbound-local\action.yml | |||
EndProjectSection | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "update-link-index", "update-link-index", "{6554F917-73CE-4B3D-9101-F28EAA762C6B}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the changes to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/_docset.yml
Outdated
@@ -9,6 +9,10 @@ subs: | |||
serverless-short: Serverless | |||
ece: "Elastic Cloud Enterprise" | |||
eck: "Elastic Cloud on Kubernetes" | |||
|
|||
#features: | |||
# PrimaryNav: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primary-nav
? We default to kebab-case (dash-case) for yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
href="@Model.UrlPathPrefix/" | ||
hx-get="@Model.UrlPathPrefix/" | ||
hx-select-oob="@Htmx.GetHxSelectOob()" | ||
href="@Model.Link("/")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ much needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two more nitpicks
|
||
string? navigationHtml; | ||
|
||
if (DocumentationSet.Configuration.Features.ContainsKey("primary-nav")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets have a static class with constant string properties so we can use Features.PrimaryNavigation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a static constant I created a class.
which can be used like
if (features.IsPrimaryNavEnabled) {
...
}
WDYT?
Tree = group ?? DocumentationSet.Tree, | ||
CurrentDocument = markdown, | ||
IsRoot = topLevelGroupId == DocumentationSet.Tree.Id, | ||
Configuration = configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we only use this in GetHxSelectOob
to get the features, set the features on the model and not the whole Configuration
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reverts commit 8edd22a.
This reverts commit 8edd22a.
Add a feature flag
PrimaryNav
which enables the custom primary navigation and splits the pages navigation needed for production.When it's disabled, it shows the full navigation (as before).
Configuration Enhancements:
Features
dictionary to theConfigurationFile
class to support feature toggles.Htmx Class Updates:
Htmx
class to include methods that utilize the newFeatures
dictionary for dynamic configuration of attributes.Navigation and HTML Rendering Improvements:
HtmlWriter
class to cache rendered navigation HTML and utilize the new configuration features for conditional rendering.MarkdownParser
instance method instead of static methods.Markdown Parsing and Rendering:
MarkdownParser
class to use instance methods and accept aBuildContext
for dynamic configuration.HtmxLinkInlineRenderer
class to use the new configuration features and dynamic attributes.Miscellaneous:
pages-nav.ts
.Results
PrimaryNav feature enabled
docs-content-nav.mp4
PrimaryNav feature disabled
docs-builder-nav.mp4