22import { getSession } from " ../lib/auth" ;
33import { appUrl , hostMode , marketingUrl } from " ../lib/host" ;
44import Brand from " ./Brand.astro" ;
5+ import ExternalLink from " ./ExternalLink.astro" ;
56import ThemeToggle from " ./ThemeToggle.astro" ;
67import UserMenu from " ./UserMenu.astro" ;
78
@@ -10,15 +11,26 @@ const pathname = url.pathname;
1011const mode = hostMode (url .hostname );
1112const session = getSession (Astro .locals );
1213
14+ // "Community" is gone (website#222). It pointed at a placeholder page
15+ // promising a forum that does not exist and was not being built; a nav entry
16+ // for a surface with nothing behind it is worse than no entry. Per-dataset
17+ // discussion is the real need it was standing in for, and that is tracked
18+ // separately against the dataset repositories' GitHub issues.
19+ //
20+ // Citation Dashboard and Documentation are separate deployments
21+ // (`nemarOrg/nemar-citations`, `nemarOrg/docs`), not routes on this site —
22+ // hence the absolute URLs, and hence `isExternal` below.
1323const marketingLinks = [
1424 { href: " /about" , label: " About" },
1525 { href: " /discover" , label: " Discover" },
16- { href: " https://dashboard.nemar.org/citations" , label: " Citation Dashboard" },
17- { href: " /community" , label: " Community" },
26+ { href: " https://dashboard.nemar.org/citations/" , label: " Citation Dashboard" },
1827 { href: " https://docs.nemar.org" , label: " Documentation" },
1928 { href: " /support" , label: " Support" },
2029];
2130
31+ /** A nav target that leaves this site, and so opens in a new tab. */
32+ const isExternal = (href : string ) => href .startsWith (" http" );
33+
2234// On the app host the nav depends on whether we can keep the user here.
2335//
2436// Signed in: relative links, so the marketing routes render on the app host
@@ -55,16 +67,16 @@ const signInHref = appUrl("/login", url.hostname);
5567 {
5668 links .map ((link ) => (
5769 <li >
58- < a
59- href = { link .href }
60- aria-current = {
61- link . href . startsWith ( " / " ) && pathname . startsWith ( link . href )
62- ? " page "
63- : undefined
64- }
65- >
66- { link . label }
67- </ a >
70+ { isExternal ( link . href ) ? (
71+ < ExternalLink href = { link .href } > { link . label } </ ExternalLink >
72+ ) : (
73+ < a
74+ href = { link . href }
75+ aria-current = { pathname . startsWith ( link . href ) ? " page " : undefined }
76+ >
77+ { link . label }
78+ </ a >
79+ ) }
6880 </li >
6981 ))
7082 }
@@ -125,7 +137,13 @@ const signInHref = appUrl("/login", url.hostname);
125137 justify-content: center;
126138 align-items: center;
127139 }
128- .primary-nav__list a {
140+ /* `:global(a)`, not a bare `a`: the external entries render their anchor
141+ inside ExternalLink.astro, which carries that component's scope id rather
142+ than this one's, so a scoped descendant selector would not reach them —
143+ Citation Dashboard and Documentation fell back to the default link style
144+ and sat in the nav at the wrong colour and size. The container class keeps
145+ its own scope, so this stays confined to this nav. */
146+ .primary-nav__list :global(a) {
129147 display: inline-flex;
130148 align-items: center;
131149 min-block-size: 44px;
@@ -137,10 +155,10 @@ const signInHref = appUrl("/login", url.hostname);
137155 text-decoration: none;
138156 transition: color 0.15s ease;
139157 }
140- .primary-nav__list a:hover {
158+ .primary-nav__list :global( a:hover) {
141159 color: var(--color-fg);
142160 }
143- .primary-nav__list a[aria-current="page"] {
161+ .primary-nav__list :global( a[aria-current="page"]) {
144162 color: var(--color-fg);
145163 box-shadow: inset 0 -2px 0 var(--brand-teal);
146164 }
0 commit comments