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

(763) Fix mainstream preview bug within guide chapters #9715

Conversation

pezholio
Copy link
Contributor

@pezholio pezholio commented Dec 9, 2024

Trello card: https://trello.com/c/WZvzmuMI/763-bug-mainstream-preview-bug-within-guide-chapters

This fixes the issue when previewing content types with multiple pages by updating all relative links to link to the preview page with the path added as a query string, allowing any content to be parsed via the GetPreviewContent service.

Additionally, because we can't reliably get all the instances within a document when parsing the content randomly, I've updated the call to instances to fetch the instance count via the Publishing API (PR here alphagov/publishing-api#3030) rather than relying on the count on the current preview page.

This can't be merged until alphagov/publishing-api#3030 is merged

@pezholio pezholio force-pushed the content-modelling/763-bug-mainstream-preview-bug-within-guide-chapters branch 3 times, most recently from 48f4709 to b642480 Compare December 10, 2024 08:57
@pezholio pezholio requested a review from Harriethw December 10, 2024 08:57
@pezholio pezholio marked this pull request as ready for review December 10, 2024 08:57
@pezholio pezholio force-pushed the content-modelling/763-bug-mainstream-preview-bug-within-guide-chapters branch from b642480 to fabc819 Compare December 10, 2024 09:05
This ensures that any local links that we click on within the frame
reload the host content endpoint with a param pointing to the original
path.

In the next commit, we’ll allow that path to be optionally loaded
This allows custom paths to be passed in and loaded when a user clicks
on a link within a preview.
This will allow any local pages (e.g. multi-page guides etc) to be
rendered via the `GetPreviewContent` service
In some circumstances (such as guides), instances can be over multiple
pages, so we can’t reliably get the number of instances from the
preview, so we need to get the metadata directly from the Publishing API
@pezholio pezholio force-pushed the content-modelling/763-bug-mainstream-preview-bug-within-guide-chapters branch from fabc819 to d8c2cad Compare December 10, 2024 09:12
Copy link
Contributor

@Harriethw Harriethw left a comment

Choose a reason for hiding this comment

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

nice!

@pezholio pezholio merged commit 44ba04f into main Dec 10, 2024
19 checks passed
@pezholio pezholio deleted the content-modelling/763-bug-mainstream-preview-bug-within-guide-chapters branch December 10, 2024 10:52
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.

2 participants