From 08c1ad2c34376f062b2fc0d3e9d7fbf3007f53ee Mon Sep 17 00:00:00 2001 From: Yibei Chen Date: Wed, 29 Apr 2026 09:30:33 -0400 Subject: [PATCH 1/3] feat: add Frequently Asked Questions section to home page 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
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) --- CONTRIBUTING.md | 4 + content/_index.md | 2 + data/faq.yaml | 66 ++++++ layouts/shortcodes/rn-faq.html | 128 +++++++++++ .../checklists/requirements.md | 37 +++ .../contracts/faq-shortcode.md | 113 ++++++++++ specs/001-faq-section/data-model.md | 75 +++++++ specs/001-faq-section/plan.md | 83 +++++++ specs/001-faq-section/quickstart.md | 86 +++++++ specs/001-faq-section/research.md | 165 ++++++++++++++ specs/001-faq-section/spec.md | 122 ++++++++++ specs/001-faq-section/tasks.md | 211 ++++++++++++++++++ 12 files changed, 1092 insertions(+) create mode 100644 data/faq.yaml create mode 100644 layouts/shortcodes/rn-faq.html create mode 100644 specs/001-faq-section/checklists/requirements.md create mode 100644 specs/001-faq-section/contracts/faq-shortcode.md create mode 100644 specs/001-faq-section/data-model.md create mode 100644 specs/001-faq-section/plan.md create mode 100644 specs/001-faq-section/quickstart.md create mode 100644 specs/001-faq-section/research.md create mode 100644 specs/001-faq-section/spec.md create mode 100644 specs/001-faq-section/tasks.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 965698d8..1e48043b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,6 +45,10 @@ Every time you add commits to the Pull Request, Netlify will automatically updat Once approved, a maintainer will merge your PR. If your changes need revision, follow their instructions and update your PR. +## Editing the home page FAQ + +The Frequently Asked Questions section on the home page is generated from a single data file: [`data/faq.yaml`](./data/faq.yaml). To add, edit, reorder, or remove a question, edit that file directly via the GitHub web UI (no template or layout changes are needed for ordinary content edits). The file's header comment documents the schema; for a longer walkthrough see [`specs/001-faq-section/quickstart.md`](./specs/001-faq-section/quickstart.md). + ## Local Development To set up a local development environment: diff --git a/content/_index.md b/content/_index.md index 9c9a9855..3decc47e 100644 --- a/content/_index.md +++ b/content/_index.md @@ -62,3 +62,5 @@ A national biotechnology development center dedicated to developing tools and se subtitle="Why reproducible neuroimaging" >}} {{< /rn-buttons >}} + +{{< rn-faq >}} diff --git a/data/faq.yaml b/data/faq.yaml new file mode 100644 index 00000000..693139f1 --- /dev/null +++ b/data/faq.yaml @@ -0,0 +1,66 @@ +# Home page Frequently Asked Questions +# +# Each item under `entries:` becomes one expandable question on the home page. +# Order in this list = order on the page. To add, edit, or remove a question, +# just edit this file and commit. +# +# Schema: +# - question: Short question text (plain text, ends with "?"). +# answer: | +# Multi-line Markdown answer. Use the "|" pipe so newlines and +# lists are preserved. Links and **emphasis** work normally. +# id: (optional) explicit URL anchor for deep-linking, e.g. +# "fellowship-apply". Use lowercase, kebab-case. If you set +# this once, you can later reword the question without +# breaking external links to it. +# +# Anchors auto-generated from the question (when no `id:` is set) take the +# form "faq-", e.g. "faq-how-do-i-get-started". Share +# https://repronim.org/#faq-how-do-i-get-started to deep-link directly. +# +# Detailed maintainer guide: specs/001-faq-section/quickstart.md + +entries: + - question: What is ReproNim? + answer: | + ReproNim is a national biotechnology development center dedicated to + developing tools and services that increase efficiency, rigor, + reproducibility, transparency, and FAIRness in neuroimaging. See the + [About page](/about/) for the center's history, team, and mission. + + - question: Who is ReproNim for? + answer: | + Researchers, students, data managers, and institutions working with + neuroimaging data — at any stage of a project. If you produce, share, + analyze, or steward MRI/EEG/MEG datasets and want to make that work + more reproducible, ReproNim's tools and guidance are aimed at you. + + - question: How do I get started? + answer: | + The [Getting Started](/resources/getting-started/) page is the best + entry point. From there you can branch into specific + [tools](/resources/tools/) and [tutorials](/resources/) depending on + what you're trying to do. + + - question: Where can I find ReproNim's tools? + answer: | + All recommended tools are catalogued on the + [Tools page](/resources/tools/), with links to documentation, tutorials, + and community help forums for each one. + + - question: How can I participate in the ReproNim community? + answer: | + Visit the [Participate page](/participate/) for current opportunities — + working groups, hackathons, webinars, and ways to contribute to ongoing + projects. + + - question: Where can I get help or attend office hours? + answer: | + Email [info@repronim.org](mailto:info@repronim.org) anytime. Virtual + drop-in office hours run on the first Thursday of every month — see the + [Help page](/help/) for details and additional support resources. + + - question: How do I apply to the ReproNim Fellowship? + answer: | + Application timelines, eligibility, and current cycle details live on + the [Fellowship page](/fellowship/). diff --git a/layouts/shortcodes/rn-faq.html b/layouts/shortcodes/rn-faq.html new file mode 100644 index 00000000..48f825b4 --- /dev/null +++ b/layouts/shortcodes/rn-faq.html @@ -0,0 +1,128 @@ +{{- with site.Data.faq -}} +{{- with .entries -}} +{{- $seen := slice -}} +
+

Frequently Asked Questions

+ + {{- range $i, $entry := . }} + {{- $q := $entry.question | default "" -}} + {{- $a := $entry.answer | default "" -}} + {{- if not $q -}} + {{- warnf "rn-faq: skipping entry %d — missing or empty 'question' field" $i -}} + {{- else if not $a -}} + {{- warnf "rn-faq: skipping entry %q — missing or empty 'answer' field" $q -}} + {{- else -}} + {{- $rawId := "" -}} + {{- with $entry.id -}} + {{- $rawId = . -}} + {{- end -}} + {{- $id := "" -}} + {{- if $rawId -}} + {{- $idPattern := `^[a-z0-9][a-z0-9-]*$` -}} + {{- if findRE $idPattern $rawId -}} + {{- $id = $rawId -}} + {{- else -}} + {{- warnf "rn-faq: id %q for question %q is invalid (must match %s); falling back to auto-generated slug" $rawId $q $idPattern -}} + {{- $id = printf "faq-%s" (urlize $q) -}} + {{- end -}} + {{- else -}} + {{- $id = printf "faq-%s" (urlize $q) -}} + {{- end -}} + {{- /* duplicate-id detection: append -2, -3, ... if needed */ -}} + {{- $finalId := $id -}} + {{- $n := 2 -}} + {{- range $seen -}} + {{- if eq . $finalId -}} + {{- $finalId = printf "%s-%d" $id $n -}} + {{- $n = add $n 1 -}} + {{- end -}} + {{- end -}} + {{- if ne $finalId $id -}} + {{- warnf "rn-faq: duplicate anchor for question %q — using %q. Consider setting an explicit 'id:' field in data/faq.yaml." $q $finalId -}} + {{- end -}} + {{- $seen = $seen | append $finalId }} +
+ {{ $q }} +
+ {{ $a | markdownify }} +
+
+ {{- end -}} + {{- end }} + + + + +
+{{- end -}} +{{- end -}} diff --git a/specs/001-faq-section/checklists/requirements.md b/specs/001-faq-section/checklists/requirements.md new file mode 100644 index 00000000..c41ef950 --- /dev/null +++ b/specs/001-faq-section/checklists/requirements.md @@ -0,0 +1,37 @@ +# Specification Quality Checklist: Frequently Asked Questions Section on Home Page + +**Purpose**: Validate specification completeness and quality before proceeding to planning +**Created**: 2026-04-28 +**Feature**: [spec.md](../spec.md) + +## Content Quality + +- [x] No implementation details (languages, frameworks, APIs) +- [x] Focused on user value and business needs +- [x] Written for non-technical stakeholders +- [x] All mandatory sections completed + +## Requirement Completeness + +- [x] No [NEEDS CLARIFICATION] markers remain +- [x] Requirements are testable and unambiguous +- [x] Success criteria are measurable +- [x] Success criteria are technology-agnostic (no implementation details) +- [x] All acceptance scenarios are defined +- [x] Edge cases are identified +- [x] Scope is clearly bounded +- [x] Dependencies and assumptions identified + +## Feature Readiness + +- [x] All functional requirements have clear acceptance criteria +- [x] User scenarios cover primary flows +- [x] Feature meets measurable outcomes defined in Success Criteria +- [x] No implementation details leak into specification + +## Notes + +- Items marked incomplete require spec updates before `/speckit-clarify` or `/speckit-plan`. +- The phrase "main tab" in the original request was interpreted as the Home page (`content/_index.md`); this is recorded explicitly in the Assumptions section so that a maintainer reviewing the spec can confirm or redirect before planning begins. +- FR-007 references WCAG 2.1 AA. While "WCAG" is a standard rather than an implementation detail, reviewers should confirm the target conformance level is appropriate for the site. +- The starter content (FR-014) bounds scope to 5–8 questions and a topic list; exact wording is intentionally deferred to maintainers. diff --git a/specs/001-faq-section/contracts/faq-shortcode.md b/specs/001-faq-section/contracts/faq-shortcode.md new file mode 100644 index 00000000..d40e985e --- /dev/null +++ b/specs/001-faq-section/contracts/faq-shortcode.md @@ -0,0 +1,113 @@ +# Contract: `rn-faq` Hugo Shortcode + +**Feature**: 001-faq-section +**Date**: 2026-04-28 + +This is the public contract the FAQ shortcode exposes to the rest of the site. It defines the input it consumes, the output HTML it produces, and the interaction guarantees that downstream tests (manual + automated accessibility) can verify against. + +## Invocation + +In a content file (e.g., `content/_index.md`): + +```markdown +{{< rn-faq >}} +``` + +The shortcode takes **no positional or named arguments**. All content comes from `site.Data.faq`. + +Optional named argument (future-friendly, not used at v1): + +| Argument | Type | Default | Purpose | +|----------|--------|---------|---------| +| `title` | string | `"Frequently Asked Questions"` | Override the section heading text. | + +## Input contract + +The shortcode reads `site.Data.faq.entries` (i.e., the `entries:` list inside `data/faq.yaml`). + +- If `data/faq.yaml` does not exist, or `entries` is missing, or `entries` is empty: the shortcode emits **no output**. +- If `entries` is non-empty: each item must conform to the schema in `data-model.md`. Invalid items are skipped with a Hugo build warning; the rest still render. + +## Output contract + +For a non-empty `entries` list, the shortcode emits this HTML structure: + +```html +
+

Frequently Asked Questions

+ +
+ What is ReproNim? +
+ +
+
+ +
+ How do I get started? +
+ +
+
+ + + + + +
+``` + +### Guaranteed properties + +- The wrapping element is a `
` with class `rn-faq` and an `aria-labelledby` pointing at the heading. Assistive tech announces the section as a named region. +- The heading is `

` so it slots correctly under the home page's `

` title. +- Each entry is a `
` element with: + - A unique `id` (per `data-model.md` rules). + - The class `rn-faq-item`. + - A child `` containing the plain-text question. + - A child `
` containing the rendered Markdown answer. +- No `open` attribute is set server-side — every entry renders collapsed (FR-002a). +- The ` - -

-``` - -### Guaranteed properties - -- The wrapping element is a `
` with class `rn-faq` and an `aria-labelledby` pointing at the heading. Assistive tech announces the section as a named region. -- The heading is `

` so it slots correctly under the home page's `

` title. -- Each entry is a `
` element with: - - A unique `id` (per `data-model.md` rules). - - The class `rn-faq-item`. - - A child `` containing the plain-text question. - - A child `
` containing the rendered Markdown answer. -- No `open` attribute is set server-side — every entry renders collapsed (FR-002a). -- The `