Skip to content

記事一覧のマークアップを改善#19

Merged
uidev1116 merged 14 commits intodevelopfrom
fix/entry-summary-markup
Dec 24, 2025
Merged

記事一覧のマークアップを改善#19
uidev1116 merged 14 commits intodevelopfrom
fix/entry-summary-markup

Conversation

@sugawara-appleple
Copy link
Contributor

@sugawara-appleple sugawara-appleple commented Dec 24, 2025

コミットメッセージだけでは伝わりずらいところについて補足します。

記事一覧での article と の使い分けについて

article を採用するケース

ページの主役となる一覧(検索結果、カテゴリ一覧など)
ユーザーが「記事を読む/探す」ことが主目的となるため、各アイテムを独立したコンテンツとして扱います。

ul / li を採用するケース

補助的な記事リスト(関連記事、サイドバーの新着記事など)
「次に読む記事を選ぶ」ためのナビゲーションとしての役割が強いため、リスト構造を採用しました。
これにより、スクリーンリーダー等で「リスト」として認識され、スキップ操作などが容易になります。

- 記事一覧を囲んでいるdivをsectionにし、sr-onlyで「記事一覧」見出しを追加
- 検索結果の件数表示を追加
- 1記事をdivではなくarticleで囲い aria-labelledby で見出しと紐付け
- 投稿日、カテゴリーに sr-only でラベルを追加
- タグリストにrole="list" と aria-label="タグ" を追加
- 画像のリサイズを縦横から横幅基準に変更
- noimage画像の alt 属性を空文字に変更
## レイアウト
- 記事一覧の日付レイアウトの余白をmarginからgapに変更し、折り返し考慮
- ページ全体レイアウトが1カラムになった時に画像が大きくなりすぎる問題対応

## マークアップ
- 新着記事がない時のコメントを追加
- 記事一覧をul化しサイドコンテンツとして扱う
- 投稿日に sr-only でラベルを追加
- noimage画像の alt 属性を空文字に変更
- キーワード検索時にh1がなかったため追加
- 記事が1件もない時に空要素が出ないよう対策
- `tag-relational-card.twig` を `article` から `ul/li` に変更
- `tag-relational-tiny.twig` を `div` から `ul/li` に変更
- `_entry.twig` のマークアップ構造を調整
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the semantic HTML markup for article listings by distinguishing between primary content and navigational/auxiliary lists. The main changes restructure templates to use <ul>/<li> for supplementary article lists (related articles, sidebars) and <article> elements for main content listings (search results, category pages), enhancing screen reader accessibility.

  • Changed auxiliary article lists from <article> to <ul>/<li> structure for better navigation
  • Enhanced accessibility with sr-only labels for dates, categories, and aria attributes
  • Updated image handling with improved conditional checks and dimension adjustments

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
themes/develop/include/entry/tag-relational-tiny.twig Converted from article elements to ul/li structure, added sr-only label for publish date, improved image condition checking
themes/develop/include/entry/tag-relational-card.twig Converted to ul/li structure, changed h2 to h3, added sr-only label for category, removed admin module include and tags display
themes/develop/include/entry/summary-tiny.twig Converted to ul/li structure, added empty state message, improved image conditionals and dimensions, added sr-only label for publish date
themes/develop/include/entry/summary-card.twig Kept article elements for main listings, restructured heading hierarchy, added aria-labelledby, sr-only labels, and improved image handling with dynamic height calculation
themes/develop/_entry.twig Changed section to aside for related articles, removed string parameter, added conditional check for offset items, reorganized module setting includes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@uidev1116 uidev1116 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

お疲れ様でした!

@uidev1116 uidev1116 merged commit 1abfad4 into develop Dec 24, 2025
@uidev1116 uidev1116 deleted the fix/entry-summary-markup branch December 24, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants