Structured FAQ block using accordion items - #483
Open
JopMolenaar wants to merge 5 commits into
Open
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
head-start | a3e5b98 | Commit Preview URL Branch Preview URL |
Jul 29 2026, 09:18 AM |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a reusable “FAQ” content model in DatoCMS and a corresponding FaqBlock that renders selected FAQ records as an accordion, including URL hash deep-linking to open a specific question.
Changes:
- Introduces
FaqBlock(Astro + GraphQL fragment + client script) and registers it in block rendering/type plumbing. - Extends page/home GraphQL queries to fetch and render the new
FaqBlockRecord. - Adds a DatoCMS migration to create the
faqcollection model +faq_blockmodular block and allow it in Page/Home body blocks.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/[locale]/_index.query.graphql | Includes the new FaqBlock fragment/type in the Home page query. |
| src/content/Pages/CollectionEntry.query.graphql | Includes the new FaqBlock fragment/type in generic Page collection entry query. |
| src/components/Accordion/AccordionItem.astro | Makes name optional and adds id passthrough for <details> (supports deep linking). |
| src/blocks/FaqBlock/README.md | Documents the new block and its DatoCMS model relationship. |
| src/blocks/FaqBlock/FaqBlock.test.ts | Adds unit tests for rendering, grouping title, content, and deep-link IDs. |
| src/blocks/FaqBlock/FaqBlock.preview.txt | Preview text for the block scaffold. |
| src/blocks/FaqBlock/FaqBlock.fragment.graphql | Defines GraphQL fragment to fetch group title + linked FAQ records and their accordion item content. |
| src/blocks/FaqBlock/FaqBlock.client.ts | Implements hash-based open + scroll behavior for targeted questions. |
| src/blocks/FaqBlock/FaqBlock.astro | Renders the FAQ group title and accordion items, wires in the client script. |
| src/blocks/blocksByTypename.ts | Registers FaqBlockRecord → FaqBlock.astro mapping. |
| src/blocks/Blocks.d.ts | Extends AnyBlock typing to include FaqBlockFragment. |
| datocms-environment.ts | Updates the configured DatoCMS environment name for this branch. |
| config/datocms/migrations/1784902160_faqBlock.ts | Adds migration creating faq + faq_block and updates Page/Home body block validators. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+20
to
+21
| openTargetedQuestion(); | ||
| window.addEventListener('hashchange', openTargetedQuestion); |
Comment on lines
+13
to
+16
| { block.groupTitle && <h2>{ block.groupTitle }</h2> } | ||
|
|
||
| <Accordion> | ||
| { faqs.map((faq) => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Associated issue
Resolves #482
How to test
Checklist