# Questions and answers

## The content model

A **question** has a title, a Markdown body, one category, any number of tags, an author, a locale, and a status. It may have an accepted answer.

An **answer** belongs to exactly one question, has a Markdown body, an author, and a status.

A **comment** attaches to a question, an answer, or a topic. Comments are deliberately lightweight — they are not a second answer surface.

Statuses are `pending`, `published`, and `hidden`. Only `published` content is publicly visible, appears in listings, feeds the counters, or enters a sitemap.

## Moderation policy

**Settings → Community → Question moderation** decides whether new questions publish immediately or wait in the queue.

Independently of that setting, the spam risk assessment can route an individual post to moderation. See [Anti-spam](../03-configuration/ANTI-SPAM.md).

## The admin question list

Filter by status, category, tag, locale, and author. Each row shows answer and comment counts, views, and whether an answer has been accepted.

Actions:

- **Publish / hide** — changes visibility and updates the counters and sitemap eligibility together.
- **Delete** — removes the question and its answers and comments.
- **Set / unset best answer** — marks the accepted answer, or clears it.

An unpublished answer cannot be accepted; the panel rejects the attempt with a translated message rather than accepting silently.

## Counters

`answers_count` and `comments_count` on a question are maintained inside the same transaction as the insert that changes them.

A comment on an **answer** increments the counter of that answer's **parent question** — not the answer's own id. This was a real defect once; it now has a regression test.

## Accepted answers

Only the question's author or a moderator/administrator may accept an answer. Accepting emits the `answer.accepted` event so plugins can react (reputation, notification, badge).

The public question page marks the accepted answer distinctly while keeping it in the normal reading order for screen readers.

## Pagination

Long questions paginate their answers. The canonical URL of page N preserves `answers_page=N` for N greater than 1 so each page self-canonicalises; transient parameters (`created`, `voted`, `answer`, `utm_*`) never enter a canonical.

Structured data reports the **total** published answer count on every page, not the count of answers rendered on the current page.

See [SEO pipeline](../07-internals/SEO-PIPELINE.md).

## Duplicate suggestions

When enabled, the ask form suggests existing similar questions while the title is typed. This is a hint, not a block — the member may still post.

## Voting, following, reporting

- **Voting** is per user, per target, and idempotent.
- **Following** a question notifies the follower about new answers.
- **Reporting** opens a moderation report. See [Moderation](MODERATION.md).

Each of these requires an active signed-in account, a POST request, and a valid CSRF token.

## Events emitted

`question.created`, `question.published`, `answer.created`, `answer.published`, `answer.accepted`, `comment.created` — all fired **after** the state is committed. See [Hooks reference](../05-extensions/HOOKS-REFERENCE.md).
