Let `_not-found` and `_error` set their title, and apply `titleTemplate` to the default one
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript
- 領域
- full-stack
調査の方向性
Start with renderPageFailure() and resolveHead(), where the fallback title is added after the head is resolved, so the template is never applied to it. Check how _not-found and _error are rendered, and whether the second proposal (a head export for error pages) is needed or whether applying the template is enough. Done means a 404 page's <title> reads Not Found | My App when titleTemplate is set, and the existing tests still pass. Confirm the design direction with a maintainer before adding a new export.
索引モデルが issue の本文から書いたものです。
説明
Version
void 1.9.0
Problem
With head: { titleTemplate: '%s | My App' } in void.config.ts, every page's tab gets the app name, except the error pages:
| Path | Status | <title> |
|---|---|---|
/ |
200 | Home | My App |
/about |
200 | About | My App |
/no-such-page |
404 | Not Found |
renderPageFailure() resolves the head with no page title, so resolveHead() never applies the template. It then adds its own title after that step:
title: head?.title ?? (status === 404 ? 'Not Found' : 'Internal Server Error')
_not-found and _error can't change this either. They can't have a .server.ts, so they have no head, and a headDefaults.title set in middleware would reach every page that sets no title of its own, not just the error pages. So the error pages can't say "Page not found" to match their heading, and they're the only tabs without the app name.
Proposal
-
Apply the template to the default title, by passing it through
resolveHead()as the page title:Not Found | My App. That's a small change, and it makes these pages match every other page without any code in the app. -
Let error pages set their title. For example, a
headexport from_not-foundand_error, taking theerrorthey render:// pages/_not-found.tsx export const head = { title: 'Page not found' };// pages/_error.tsx export const head = (error: PageError) => ({ title: error.status === 404 ? 'Page not found' : 'Something went wrong', });
Prior art
- Next.js:
not-found.tsxcan exportmetadata, and the root layout'stitle.templateapplies to it. - Nuxt:
error.vuecallsuseHead(), and the app'stitleTemplateapplies. - SvelteKit:
+error.sveltesets its title with<svelte:head>.
- 主要言語
- TypeScript
- スター
- 684
- フォーク
- 83
- 平均マージ
- 15時間 22分
- マージ済み PR(30日)
- 219
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/void のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
voidzero-dev/void#835 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
voidzero-dev/void#834 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
voidzero-dev/void#833 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
voidzero-dev/void#832 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
voidzero-dev/void#808 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/void の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-webui/tether#52 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AykutSarac/jsoncrack.com#616 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
melgarafael/DeskcommCRM#4679 ·
メンテナーはふだん 1 日以内に返信
-
enhancement size:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信