-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
✨ Site Nav from tag graph #4439
base: master
Are you sure you want to change the base?
Conversation
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 0 ✅ Edited: 2025-01-13 22:01:06 UTC |
e9a303e
to
9af48d6
Compare
isOnHomepage = props?.content?.type === OwidGdocType.Homepage | ||
} | ||
ReactDOM.render( | ||
<SiteNavigation |
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.
Technically we don't need to fetch the topicTagGraph.json
when we're on the homepage, because it's already embedded in the homepage gdoc's homepageMetadata
, but seeing as the JSON request is ~4kB transferred, I think it's okay to not optimize.
Later, we should see if it's possible to get this file and dods.json
to cache.
9af48d6
to
ad4d4b7
Compare
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.
nice to see the merging of tag and topics taking shape more visibly!
It seems like the order of tags in the graph is a bit arbitrary at the moment on live, are we waiting for authors to reorder before merging?
{area.children.map(({ slug, name }) => ( | ||
<li | ||
className="homepage-topic__topic-entry" | ||
key={`topic-entry-${slug}`} | ||
> | ||
<a href={`/${slug}`}>{name}</a> | ||
</li> | ||
))} |
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.
we dropped subcategories then? I'm guessing yes since they're not part of the tag graph, but just wanted to check.
SELECT COUNT(DISTINCT(t.slug)) | ||
FROM tags t | ||
LEFT JOIN posts_gdocs p ON t.slug = p.slug | ||
WHERE t.slug IS NOT NULL AND p.published IS 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.
for coherence in the defintion of topic, add the p.type IN ('topic-page', 'linear-topic-page', 'article')
condition from getFlatTagGraph()
?
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 is a couple of edits here related to narrative charts, seems incidental but checking
) | ||
) | ||
}) | ||
return slug === "coronavirus" |
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 ran a local bake to check this, and these are the slugs calling isPostSlugCitable:
- history-of-poverty-data-appendix
- food-explorers
- privacy-policy
- thank-you
- donations-faq
- glossary
- about
- former-team-members
- about
- owid-grapher
- about
- coverage
- teaching
- ukraine-war
None of these are citable, so that function can just be a noop until we do a bigger refactor.
"coronavirus" (as in the landing for country profiles, e.g. /coronavirus/country/usa) is not listed here because country profiles landing pages are assumed to be citable, and don't run through that function.
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.
nit: maybe worth renaming "category" -> "area" here too?
Removes the hardcoded
SiteNavigationStatic
object that powered the site nav and replaces it with a JSON file representation of the tag graph from the database.As a reminder, the tag graph shape is: