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

AV-75840 top nav highlight #178

Merged
merged 4 commits into from
Apr 8, 2024
Merged

AV-75840 top nav highlight #178

merged 4 commits into from
Apr 8, 2024

Conversation

osfameron
Copy link
Contributor

@osfameron osfameron commented Apr 2, 2024

This PR adds a highlight to the top nav for which section we're in:

You can currently see it in action on Staging:
image

The logic used is:

osfameron and others added 3 commits March 28, 2024 17:17
This is more complicated than it looks, partly because the Nav data-structure
is a bit odd (e.g. the Home icon isn't generated from the Home configuration for...
reasons?)

This involves grubbing around in the site keys, and is therefore dependent
on magic globals that are created while running templating code...

(e.g. it works, but will require some documentation or rework, as will be fun
to debug in future)
@sarahlwelton
Copy link
Contributor

I don't see any of the duplication behaviours on the preview site that you've provided anymore, and the spacing looks to be what I'd expect. I can 👍 this if we want to get it merged, or we can wait for further comments.

@osfameron osfameron marked this pull request as ready for review April 4, 2024 09:14
@osfameron osfameron requested a review from a team April 4, 2024 09:14
@@ -9,7 +9,8 @@
</a>
</li>
<li>
<a class="navbar-brand cb-documentation" href="{{#with (and site.url site.homeUrl)}}{{{@root.site.url}}}{{{this}}}{{else}}{{{siteRootPath}}}{{/with}}">
<a class="navbar-brand cb-documentation"
href="{{#if (and site.url site.homeUrl)}}{{{site.url}}}{{{site.homeUrl}}}{{else}}{{{siteRootPath}}}{{/if}}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious if this still works as expected with replacing the #with helper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! So with is basically an if but with scoping.

So {{{@root.site.url}}}{{{this}}}
relied on that behaviour + and's behaviour (or returning the second truthy value on success) which honestly is a bit "cute" to understand.

This refactor just makes the logic a bit more explicit.

@osfameron
Copy link
Contributor Author

Deployed the contribute/style-guide nav changes to Staging and looks like this logic does NOT work for that:
e.g. https://staging.docs-test.couchbase.com/home/contribute/index.html

Is this a blocker? (e.g. getting to the writer's guide is something you generally don't do by accident, so not sure if this needs to delay pushing it out?)

@sarahlwelton
Copy link
Contributor

Deployed the contribute/style-guide nav changes to Staging and looks like this logic does NOT work for that: e.g. https://staging.docs-test.couchbase.com/home/contribute/index.html

Is this a blocker? (e.g. getting to the writer's guide is something you generally don't do by accident, so not sure if this needs to delay pushing it out?)

What would we even expect to highlight in the top nav for this? The home icon?

I honestly think it's negligible and not a blocker. We care more about the actual product highlighting, not highlights for something that's largely supposed to be internal.

@osfameron
Copy link
Contributor Author

Thanks @sarahlwelton, that makes sense.
I was thinking of it as part of "Home" because that's where this kind of content used to be, but now it's not even really that technically.

(Is a little odd that the old Writer's Guide content, under /home/contribute doesn't trigger it, but would arguably be weirder if only that one section did)

@osfameron osfameron merged commit 6067e42 into master Apr 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants