-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEO関連メタタグの設定 #4987
SEO関連メタタグの設定 #4987
Conversation
Codecov Report
@@ Coverage Diff @@
## 4.1-feature #4987 +/- ##
=================================================
- Coverage 76.18% 76.14% -0.05%
Complexity 6124 6124
=================================================
Files 437 437
Lines 20736 20736
=================================================
- Hits 15798 15789 -9
- Misses 4938 4947 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
459c274
to
b0f8d15
Compare
@matsuoshi |
metaタグのテストの Symfony4.4 対応
@@ -0,0 +1,28 @@ | |||
{% if Product is defined %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
twig変数の存在チェックだと、カスタマイズ時に誤動作しそうなので、商品一覧と詳細のルーティングで判定したほうがよいかもしれません。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます、 app.request.get('_route')
で判定するように変更しました
{% elseif Category is defined %} | ||
{% set meta_og_type = 'article' %} | ||
{% set meta_description = Page.description %} | ||
{% set meta_canonical = url('product_list', {'category_id': Category.id|default(null)}) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
検索キーワードは含めないでよいですか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「検索キーワード」は管理画面で入力する meta keyword のことでしょうか、であれば従来どおり default_frame.twig で出力しており、今回は変更していません
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matsuoshi
フロントでのキーワード検索を行った際のcanonicalとog:urlですね。
同じcategory_idでもキーワード検索が入ると結果が変わってくるので
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chihiro-adachi はい、ここは意図したのもでして、一覧ページでは検索クエリ、ページ番号、orderby などは canonical に含めないようにしています
(カテゴリID以外のパラメタを canonical には指定せず、パラメタ違いで別ページと認識されるのを防ぐ)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。了解しました。
@chihiro-adachi コメントありがとうございます、修正を入れています |
こちらの内容は #5019 にて取り込まれましたのでクローズします。 |
4.1 feature向けのPRです
概要(Overview・Refs Issue)
SEOやSNSシェア対応のため、metaタグ関連の以下を設定します
方針(Policy)
メタ関連の新規twigファイル meta.twig を作成しました。
4.0系では「ページ管理」のメタ設定 → metatag にてタグを設定していますが、タグのテンプレートとしては twig 側にあったほうがカスタマイズしやすいかと考えました。
(互換性のため、「ページ管理」の metatag に値が設定されている場合はそちらを優先し、空の場合のみ meta.twig ファイルを読み込むようにしています)
実装に関する補足(Appendix)
商品詳細の description と og:description は、以下から設定しています (上のものが優先される)
テスト(Test)
Webテストを追加しています。
相談(Discussion)
デフォルトの og:image 画像を設定したいが、どのような実装方法がよいか
その他よい方法がありましたら。
マイナーバージョン互換性保持のための制限事項チェックリスト
レビュワー確認項目
新機能追加に伴う競合確認