---
title: "レイアウトサービスの拡張"
slug: "extending-the-layout-service"
abstract: "レイアウトサービスが返すデータのカスタマイズオプションの概要"
---
# レイアウトサービスの拡張

レイアウトサービスの出力をカスタマイズしたい場合は、以下のオプションがあります:

-   [レイアウトサービスから返されるコンテキストデータの拡張](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/extending-context-data-returned-by-the-layout-service.html "Extending context data returned by the Layout Service")。
-   [レイアウトサービスのレンダリング出力のカスタマイズ](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/customizing-the-layout-service-rendering-output.html "Customizing the Layout Service rendering output")。
-   [Sitecoreフィールドのシリアライズをカスタマイズ](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/customize-the-serialization-of-a-sitecore-field.html "Customize the serialization of a Sitecore field")できます。
-   [カスタムレイアウトサービス構成をJSSで使用](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/using-a-custom-layout-service-configuration-with-jss.html "Using a custom Layout Service configuration with JSS")しています。

## セキュリティ上の考慮事項

レイアウトサービスの出力は安全ではなく、クライアント側で検査可能です。オープンAPIのように扱い、機密データや過剰なデータを露出させないようにしましょう。

オブジェクトSitecore Context拡張やカスタムRendering Content Resolversを構築する際:

-   フロントエンドコンポーネントに必要なフィールドのみを追加してください。例えば、バックエンドSitecoreパイプラインからLayout ServiceレスポンスにSitecoreコンテキストオブジェクト全体を注入しないでください。
-   グローバルなアプリ状態を表すデータを追加し、複数のコンポーネントがアクセスする必要があります。
-   機密情報の露出は避けてください。複雑なオブジェクトを通じて誤って追加データを露出させないように、シリアライズの深さに注意してください。