Repository navigation
Add disambiguation pages with editor templates and reader notices - #9
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 535113ce89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return c.json({ error: ui("m_8dd4e38868d9e2ba") }, 400); | ||
| } | ||
|
|
||
| if (isDisambiguation(body.content) && body.redirect_to) return c.json({error:ui('disambiguation.redirectConflict')},400); |
There was a problem hiding this comment.
Enforce the redirect conflict in every mutation path
This guard only covers direct PUT /api/w/:slug saves, so the stated invariant can still be violated by other existing writers. MCP approval passes draft.content and draft.redirect_to directly to commitPageMutation (src/utils/mcpDraftApply.ts:222-230), pending-edit approval does likewise (src/routes/pending-edits.ts:770-779), and reverting a currently redirected page can restore a marked revision without changing redirect_to (src/routes/wiki.ts:3612-3731). Validate the final content/redirect pair in the shared mutation layer, and in the revert path, so these workflows cannot persist a page that is both a redirect and a disambiguation page.
Useful? React with 👍 / 👎.
| editor.setMarkdown(setDisambiguation(ui('disambiguation.template',[name]),true)); | ||
| }; | ||
| checkbox.checked = !!editor && isDisambiguation(editor.getMarkdown()); | ||
| controls.style.display = sectionMode ? 'none' : ''; |
There was a problem hiding this comment.
Restore the type controls after section-mode fallback
When an edit opens with sectionMode set, this permanently hides the new controls unless the page is reloaded. If the requested section no longer exists, the fallback at main.ts:2932-2936 switches to full-document editing without restoring this element; likewise, the section-conflict promotion at main.ts:4320-4330 restores the other metadata wrappers but omits disambiguationType. In both cases the user is now editing the whole page but cannot mark or unmark its type, so every transition back to full-edit mode needs to reveal this wrapper too.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,13 @@ | |||
| /** Kept in the document so revisions, Git and MCP preserve the page type together. */ | |||
| export const DISAMBIGUATION_MARKER = '<!-- vireowiki:disambiguation -->'; | |||
There was a problem hiding this comment.
Remove the marker before deriving SEO descriptions
Every marked page passes this HTML comment unchanged to extractMetaDescription(page.content) in src/index.ts:784-790. That extractor removes ordinary HTML tags but not comments, so the generated description begins with the literal <!-- vireowiki:disambiguation -->; it is then used for both standard and Open Graph description metadata and for crawler responses. Strip the marker before description extraction so search and link previews expose the actual article text rather than internal metadata.
Useful? React with 👍 / 👎.
| // 넘겨주기(redirect) 변경 시 편집 요약 자동 갱신 | ||
| // input: 매 키 입력마다 디바운스로 갱신 (입력 중간 prefix 가 길어졌다 짧아졌다 반복하는 것 완화) | ||
| // change: blur 직후 즉시 확정 | ||
| const redirectField = document.getElementById('redirectInput')?.closest('.mb-3'); |
There was a problem hiding this comment.
Hide the controls for raw extension documents
This condition also adds the disambiguation controls when isExtensionData is true. Those namespaces deliberately use the raw textarea and R2-only storage, and the reader bypasses renderWikiContent, passing page.content directly to the extension renderer (src/client/pages/index.ts:975-1042). Checking the box therefore prepends a Wiki HTML comment to an extension's raw data without ever showing the reader notice, while the template button can replace the dataset with Markdown; extension editors should not expose these document-type controls.
Useful? React with 👍 / 👎.
Editors can mark a document as a disambiguation page and generate a localized template linking its different meanings. Readers see a notice and type badge; API responses expose is_disambiguation. Section editing cannot change the whole-page type, and disambiguation pages cannot also redirect.
The type is a canonical leading source comment shared by the editor, renderer and server, so normal Wiki permissions, revisions, Git and MCP retain it together with the content. Unmarking preserves the body. Server AI rendering removes the technical marker and includes the explanation. Both existing renderer implementations use the shared marker helper.
Validation: server/client typechecks, full build and 42 localized shells, real Git tests, and nine service tests including API save/read, revision preservation, redirect conflict, source toggling, code examples and AI output. Documentation updated.