# 特定のページでのみテンプレートをオーバーライドする

**URL:** <https://meta.discourse.org/t/override-template-only-on-specific-page/132288>\
**Category:** Development\
**Created:** [2019 年 10 月 30 日午後 10:50 UTC](https://meta.discourse.org/t/override-template-only-on-specific-page/132288 "2019-10-30T22:50:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Antichrist](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antichrist/32/159976_2.png) [@Antichrist](https://meta.discourse.org/u/Antichrist)\
**Post date:** [2019 年 10 月 30 日午後 10:50 UTC](https://meta.discourse.org/t/override-template-only-on-specific-page/132288/1 "2019-10-30T22:50:01Z")

</div>

こんにちは、Discourse の外観をテーマのカスタム `<head>` フィールドでカスタマイズしています。  
`<script type="text/x-handlebars" data-template-name="components/categories-only">` などのスクリプトを使用して、特定のテンプレートをオーバーライドしています。これをホームページなどの特定のページでのみオーバーライドし、サブカテゴリの表示では異なるコードを使用することは可能でしょうか？Discourse のことはまだあまり詳しくなく、テーマのカスタム HTML/CSS で正しい方法かどうかさえ確信がありません（アップデート時に失われることはわかっています）。もしお力になれる方がいらっしゃれば、大変感謝いたします。

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/1/a1dfcf9a6995c877cbcbcba89c82abfe28bef804.png)  
 ![image](https://global.discourse-cdn.com/meta/original/3X/6/c/6cca591e13d9906970c867a1a7f4555efce89dad.png)

---

_[View the full topic](https://meta.discourse.org/t/override-template-only-on-specific-page/132288)._
