Skip to content

Commit

Permalink
Merge pull request #3161 from owid/endnotes-sticky-nav
Browse files Browse the repository at this point in the history
🐛 only include endnotes in sticky nav if endnotes exist
  • Loading branch information
ikesau authored Feb 5, 2024
2 parents 5cb2514 + c961959 commit 82b13e9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions db/model/Gdoc/archieToEnriched.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
RESEARCH_AND_WRITING_ID,
checkIsPlainObjectWithGuard,
identity,
isEmpty,
} from "@ourworldindata/utils"
import { convertHeadingTextToId } from "@ourworldindata/components"
import { parseRawBlocksToEnrichedBlocks, parseRefs } from "./rawToEnriched.js"
Expand Down Expand Up @@ -100,12 +101,15 @@ export function generateStickyNav(
})
)

if (!isEmpty(content.refs?.definitions)) {
stickyNavItems.push({
text: "Endnotes",
target: `#${ENDNOTES_ID}`,
})
}

stickyNavItems.push(
...[
{
text: "Endnotes",
target: `#${ENDNOTES_ID}`,
},
{
text: "Cite This Work",
target: `#${CITATION_ID}`,
Expand Down

0 comments on commit 82b13e9

Please sign in to comment.