-
-
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?
Changes from all commits
ffd0f9e
7045072
1a19923
dad4377
7ddc63f
efebb3d
70fd095
ad4d4b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ import { | |
parsePostWpApiSnapshot, | ||
FullPost, | ||
JsonError, | ||
CategoryWithEntries, | ||
WP_PostType, | ||
FilterFnPostRestApi, | ||
PostRestApi, | ||
|
@@ -40,7 +39,6 @@ import { | |
CLOUDFLARE_IMAGES_URL, | ||
} from "../../settings/clientSettings.js" | ||
import { BLOG_SLUG } from "../../settings/serverSettings.js" | ||
import { SiteNavigationStatic } from "../../site/SiteConstants.js" | ||
import { decodeHTML } from "entities" | ||
import { getAndLoadListedGdocPosts } from "./Gdoc/GdocFactory.js" | ||
|
||
|
@@ -185,22 +183,9 @@ export const getFullPostByIdFromSnapshot = async ( | |
return getFullPost(trx, postEnriched.wpApiSnapshot) | ||
} | ||
|
||
// TODO: I suggest that in the place where we define SiteNavigationStatic we create a Set with all the leaves and | ||
// then this one becomes a simple lookup in the set. Probably nicest to do the set creation as a memoized function. | ||
// This function used to be more complicated, but now the only citable WP post is the COVID page | ||
export const isPostSlugCitable = (slug: string): boolean => { | ||
const entries = SiteNavigationStatic.categories | ||
return entries.some((category) => { | ||
return ( | ||
category.entries.some((entry) => entry.slug === slug) || | ||
(category.subcategories ?? []).some( | ||
(subcategory: CategoryWithEntries) => { | ||
return subcategory.entries.some( | ||
(subCategoryEntry) => subCategoryEntry.slug === slug | ||
) | ||
} | ||
) | ||
) | ||
}) | ||
return slug === "coronavirus" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
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. |
||
} | ||
|
||
export const getPostsFromSnapshots = async ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
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 fromgetFlatTagGraph()
?