feat: add Frequently Asked Questions section to home page - #468
feat: add Frequently Asked Questions section to home page#468yibeichan wants to merge 3 commits into
Conversation
✅ Deploy Preview for repronim ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review
This pull request introduces a data-driven FAQ section to the home page, featuring a new shortcode, a YAML data file for content management, and comprehensive documentation for maintainers. Additionally, it includes a fix for the RSS template to ensure compatibility with Hugo 0.160+ by transitioning from the legacy author object to site parameters. Feedback focuses on improving the robustness of the RSS template against missing configuration, enhancing the user experience for deep-linked FAQ items by accounting for sticky headers in the CSS, and ensuring the FAQ script handles multiple instances on a single page correctly.
| template error. This override reads the same values from | ||
| site.Params.author (set in hugo.yaml). | ||
| */ -}} | ||
| {{- $author := site.Params.author -}} |
There was a problem hiding this comment.
Accessing fields on $author will cause a template error if site.Params.author is missing from the configuration. Using default (dict) ensures $author is always an object, making the subsequent .email and .name checks safe even if the author configuration is omitted.
{{- $author := site.Params.author | default (dict) -}}
| .rn-faq-item { | ||
| border-top: 1px solid rgba(127, 127, 127, 0.3); | ||
| padding: 0.75rem 0; | ||
| } |
There was a problem hiding this comment.
Since the site uses a sticky navigation bar, deep-linking to an FAQ entry (e.g., via /#faq-id) will cause the question to be partially obscured by the header. Adding scroll-margin-top ensures that the element is positioned with enough clearance when scrolled into view by the browser or the scrollIntoView script.
| .rn-faq-item { | |
| border-top: 1px solid rgba(127, 127, 127, 0.3); | |
| padding: 0.75rem 0; | |
| } | |
| .rn-faq-item { | |
| border-top: 1px solid rgba(127, 127, 127, 0.3); | |
| padding: 0.75rem 0; | |
| scroll-margin-top: 5rem; | |
| } |
| (function () { | ||
| function openFromHash() { |
There was a problem hiding this comment.
If this shortcode is used multiple times on the same page, the hashchange event listener will be attached multiple times, leading to redundant execution of the openFromHash function. Adding a global guard ensures the initialization logic runs only once per page load.
| (function () { | |
| function openFromHash() { | |
| (function () { | |
| if (window.rnFaqInitialized) return; | |
| window.rnFaqInitialized = true; | |
| function openFromHash() { |
|
Thanks @yibeichan! This raises a good point, its been a while since updating Hugo or the theme. I expect that will need some additional changes on the Netlify side, I'd prefer to do that bump separately though, would you mind opening a separate PR for that? (I haven't looked but I hope we can also bump the theme and avoid the new override.) I love the faq idea :) |
|
I'd recommend @memartone and @juliebates have a look at this, since it has echoes of early discussions by the web team about site navigation. At issue is not only the FAQ itself but whether navigation can be improved (see the original comment). |
Adds an FAQ section below the existing intro and section buttons on
the home page. Maintainers manage the content via a single data file
(data/faq.yaml); a new rn-faq Hugo shortcode renders each entry as
an HTML5 <details> element so accordion semantics, keyboard
operability, and screen-reader announcement come from the browser
without any JS framework.
- data/faq.yaml: 7 starter questions covering what ReproNim is, who
it's for, getting started, tools, participation, help/office hours,
and the fellowship. Schema documented in a header comment.
- layouts/shortcodes/rn-faq.html: rendering loop with anchor id
generation, validation warnings (warnf) for malformed entries,
scoped styles that honor light/dark themes, and a small inline
script that opens the targeted entry on hash-based deep links.
- content/_index.md: invokes {{< rn-faq >}} after rn-buttons.
- CONTRIBUTING.md: short pointer to data/faq.yaml for FAQ edits.
- specs/001-faq-section/: full spec, plan, research, data model,
contract, quickstart, tasks, and quality checklist.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Move specs/001-faq-section/quickstart.md to docs/maintaining-faq.md
and refit its framing from "feature spec appendix" to standalone
maintainer guide. The file lives outside content/, so Hugo does
not render it on the website.
- Remove the other speckit process files (spec, plan, research,
data-model, tasks, contracts/, checklists/). They were one-time
design notes; the production code, data/faq.yaml header comment,
CONTRIBUTING.md, and docs/maintaining-faq.md are the durable docs.
- Add a hidden HTML comment in content/_index.md next to the
{{< rn-faq >}} call so anyone landing there via the site's
"Edit this page" link is pointed at data/faq.yaml.
- Update the link in CONTRIBUTING.md and in the data/faq.yaml header
comment to the new docs/ path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thanks @asmacdo! Split the Hextra RSS-template fix into #470 so this PR is FAQ-only. Force-pushed Diff for this PR is now scoped to: #470 is intended as a stop-gap — happy to close it without merging if a Hugo + Hextra bump removes the need. Re: the cc @memartone @juliebates per @chaselgrove — would love your eyes on the FAQ wording itself, especially the seven starter questions in |
|
hi all - @yibeichan @asmacdo @chaselgrove @memartone @dnkennedy Dave thought the website group should discuss FAQ page(s) at this week's meeting, so I haven't tried to type things in here as it seems like a larger conversation, I think this is the second set of FAQs topics to come up recently, so I don't know how to comment yet! |
Hextra's navbar sticks to the top of the viewport (height ~ 4rem from the theme's --navbar-height variable). When a visitor opens a deep link like /#faq-some-question, the inline script's scrollIntoView would position the targeted entry at the very top of the document, hidden behind the sticky navbar. Adds scroll-margin-top to .rn-faq-item using the theme's variable so the targeted entry lands cleanly below the navbar with a small buffer. The fallback (4rem) keeps the behavior reasonable if the variable is ever missing. Verified headlessly: scroll-margin-top resolves to 72px in Chromium; deep-linked entry's top position sits ≥ navbar bottom edge (64px) after the inline script runs. Addresses gemini-code-assist review feedback on PR ReproNim#468. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed the sticky-header item from .rn-faq-item {
border-top: 1px solid rgba(127, 127, 127, 0.3);
padding: 0.75rem 0;
+ /* Offset deep-link scroll so the targeted entry lands below the
+ Hextra sticky navbar (--navbar-height) instead of behind it. */
+ scroll-margin-top: calc(var(--navbar-height, 4rem) + 0.5rem);
}Verified in Chromium that after Leaving the other two
|
|
@juliebates it would be great if you could let zoom transcribe your website design meeting, and let me know which items/tasks need my action, then i'll do it. |
|
@yibeichan @dnkennedy @memartone @asmacdo @chaselgrove Thank you so much @yibeichan, both for creating this example and making it so functional that it really prompts constructive thinking. The website group loves what you've done, and s is still thinking about where to put the FAQs, as well as the overall objectives for them, so we have a few things to flush out yet - but your handiwork will definitely go somewhere! We'll be back in touch after we get things sorted a bit further. Thank you for the inspiration, tangible examples are so useful! |
|
Thanks for this, I think an FAQ will be very valuable. I think we probably do want to move it, final location tbd, no need to change that we will do the change when we decide where it ultimately goes (possibly its own page). IMO, I think we should remove doc/maintaining-faq.md, its a bit heavy. We should have enough in the header of the faq.yaml that folks could edit. And a link to the faq.yaml like "Edit/add an faq entry". But dont actually do that yet, the web team wants to discuss how to proceed. |
|
As discussed in the meeting, we are gonna move this to the Help page, trim this down to a couple of FAQs that we know we want, and we can exercise adding FAQs as we go. I'll take over this one to trim it back/move etc. @yibeichan thanks again! |
What this changes
Adds a Frequently Asked Questions section to the bottom of the home page so first-time visitors can find quick answers (what ReproNim is, who it's for, how to get started, etc.) without having to navigate elsewhere.
Each question is a click-to-expand entry. All entries start collapsed; visitors can have several open at once.
The set of questions ships with 7 entries pulled from existing site copy. Wording is easy to revise — see "How to add or change a question" below.
How to add or change a question
To add, edit, reorder, or remove an FAQ entry, you only edit one file:
data/faq.yaml. No template, no layout, no theme code.Step-by-step walkthrough (with screenshots-of-source examples) is in
docs/maintaining-faq.md. A short pointer was also added toCONTRIBUTING.md.If a contributor lands in
content/_index.mdvia the site's "Edit this page" link, an HTML comment right next to the FAQ shortcode points them atdata/faq.yamlso they don't get lost.Sharable links to specific answers
Each question has a stable URL anchor. You can share, for example:
https://repronim.org/#faq-how-do-i-get-started…and the page will open with that question already expanded and scrolled into view. Useful for support emails, Slack replies, and forum posts.
Why three commits
fix:Hextra RSS template overridehugo serverfrom starting. Netlify pins an older Hugo so production was unaffected, but the local dev workflow was broken. This fixes that.feat:FAQ sectiondocs:move maintainer guidedocs/maintaining-faq.md(outsidecontent/, so it's repo-internal and not published).Reviewer test plan
Once Netlify spins up the preview deploy:
#faq-how-do-i-get-startedto the preview URL. The page should jump to that question with it already expanded.data/faq.yaml, click the GitHub pencil to start editing. The header comment explains the schema; the workflow feels like editing any other content page.What I checked before opening this PR
Ran an automated suite against
hugo server(Playwright for browser interactions, axe-core for accessibility, Lighthouse for performance):entries: [])Tooling and full results are reproducible from
hugo server; happy to share scripts on request.Known limitation (not introduced by this PR)
The site's search box (top-right "Search") doesn't currently index the home page, so FAQ content is not findable through site search. This is pre-existing Hextra behavior and is independent of this PR — confirmed by reproducing the same gap on
main. If FAQ-via-search is something we want, it's worth a separate issue: either configure Hextra to index the home page, or move the FAQ to a dedicated/faq/page.🤖 Generated with Claude Code