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

Prerequisites to reduce duplicate content #1695

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

notlee
Copy link
Contributor

@notlee notlee commented Jun 6, 2024

See commit messages.

To avoid duplicating content, we want to write brand specific
sections of mdx using .astro components to render portions of
mdx only for select brands. However Starlight finds headings
by inspecting mdx before this happens. This means content is hidden
correctly, but there are links within table of contents components
(sidebar, in page links) which show links to headings which do not
exist on branded pages.

This post-process script removes heading links from table of content
components where the heading does not exist on the page. It is a little
fragile, as it depends on Strlight markup not changing. We decided as
a team this is a reasonable approach for the medium term. It was our
prefered approach compared with maintaining a fork, or other much more
time consuming customisations.

We anticipate moving away from Starlight in 2025 to re-brand Origami
to the FT Design System.
We "brand" content using Starlight's internationalisation feature.
We duplicate lots of content currently as we need to make small
content changes per brand (language), e.g. to show a "mono" theme
for the button component only for the "core" brand. If we
pass the brand (language) to mdx we can avoid duplicating content
(super hard to manage) and instead show this section on condition
of the current brand. We intent to make an upstream PR to pass
down this data. In the meantime, we patch.
@notlee notlee requested a review from a team as a code owner June 6, 2024 14:26
@origamiserviceuser origamiserviceuser added this to Backlog in Origami ✨ Jun 6, 2024
@notlee notlee temporarily deployed to origami-webs-reduce-dup-xijvdm June 6, 2024 14:33 Inactive
@notlee notlee enabled auto-merge (rebase) June 6, 2024 15:31
@notlee notlee merged commit 5b98f83 into main Jun 6, 2024
9 checks passed
Origami ✨ automation moved this from Backlog to Done Jun 6, 2024
@notlee notlee deleted the reduce-duplicate-content-pre-req branch June 6, 2024 15:33
const items = tocComponent.querySelectorAll('li');
const extraItems = Array.from(items).filter(item => {
const anchor = item.querySelector('a');
const anchorId = anchor.href.replace(/^(.+)#/, '');
Copy link
Contributor

Choose a reason for hiding this comment

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

Think we might have runtime probllem here if no a's come back. Possibly want to ignore filtering this specific element if there's no a?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Origami ✨
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants