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

🎉 add data insights to algolia pages index #4541

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Feb 7, 2025

Resolves #4507

Figma

Adds Data Insights as a supported gdoc type in the indexPagesToAlgolia script.

Most of this PR's diff comes from updating the union type PageType to use the OwidGdocType enum so that I could call getCanonicalURL in the search panel (to correctly prefix the slug with /data-insights/)

I also added a slightly complicated getFirstBlockOfType implementation because my first attempt at this change needed to get both the first image and first paragraph. It's less essential for the PR on the whole, now, but I think will still be a useful util to keep around.

image

@ikesau ikesau self-assigned this Feb 7, 2025
@@ -105,15 +106,20 @@ async function generateWordpressRecords(
const getPostTypeAndImportance = (
Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to rewrite the PageType type to use the OwidGdocType enum so that it would be compatible with getCanonicalUrl which we now need to be able to link to data insights correctly on the search page, so I had to refactor these 3 functions that each had a pattern match statement.

@ikesau ikesau force-pushed the data-insights-in-algolia branch from e69cbaf to 1595b38 Compare February 18, 2025 22:39
@ikesau ikesau requested review from mlbrgl and removed request for mlbrgl February 18, 2025 22:48
@ikesau ikesau force-pushed the data-insights-in-algolia branch from 1595b38 to 79c6628 Compare February 20, 2025 21:53
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.

Add data insights to search
1 participant