---
title: "ウォークスルー:SXAでの「はじめき」テンプレートの活用法"
slug: "walkthrough--using-the-getting-started-template-with-sxa"
abstract: "ヘッドレスのGetting StartedテンプレートをSitecore Experience Accelerator(SXA)で使う方法。"
---
# ウォークスルー:SXAでの「はじめき」テンプレートの活用法

このウォークスルーでは、SXAで[Getting Startedテンプレート](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--using-the-getting-started-template.html "Walkthrough: Using the Getting Started template") の使い方を説明します。JSSテナントを使って、マルチサイト、デザイン、その他のプラットフォーム拡張機能などのSXA機能を有効にすることができます。

SXAでGetting Startedテンプレートを使うには:

-   [環境を整えましょう](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--using-the-getting-started-template-with-sxa.html#UUID-a0ecd94a-cfef-b8fb-1c64-a32a8eabec29_section-idm232200890162617 "Prepare your environment")
-   [MyProjectソリューションの作成](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--using-the-getting-started-template-with-sxa.html#UUID-a0ecd94a-cfef-b8fb-1c64-a32a8eabec29_section-idm232200904554361 "Create the MyProject solution")
-   [アイテムの復元とシリアル化](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--using-the-getting-started-template-with-sxa.html#UUID-a0ecd94a-cfef-b8fb-1c64-a32a8eabec29_section-idm232207522587972 "Restore and serialize items")

## 環境を整えましょう

JSSテナントを作成する前に、まず環境をセットアップする必要があります。

環境を準備するために:

1.  init.ps1スクリプトを呼び出すまでは[Getting Started](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--using-the-getting-started-template.html "Walkthrough: Using the Getting Started template")テンプレートをインストールして実行してください。ただし、up.ps1スクリプトは*実行しないでください*。もし実行する場合は、docker-compose downコマンドと.\\docker\\clean.ps1スクリプトを実行してから進めてください。
    
2.  [Sitecoreモジュールの参照](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/sitecore-module-reference.md "Sitecore module reference")のガイダンスに従って、コンテナ環境にSitecore PowerShell拡張とSXAを追加してください。
    
3.  Visual Studioでは、Platform\\App\_Config\\Include\\Sites.configファイルを削除してください。外部からファイルを削除する場合は、Visual Studioからも削除しなければなりませんPlatform.csproj。
    
4.  コンテナを発射するには、docker-compose up -dを実行してください。
    
5.  src\\items\\contentフォルダの内容を削除してください。
    
6.  ファイルからcontent includeを削除Items.module.json:
    
    {
     "name": "content",
     "path": "/sitecore/content/MyProject"
    },
    
7.  [Sitecoreコマンドラインインターフェース(CLI)](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/sitecore-command-line-interface.md "Sitecore Command Line Interface")を使ってログインしてください:
    
    dotnet sitecore login --cm https://cm.myproject.localhost/ --auth https://id.myproject.localhost/ --allow-write true
    
8.  dotnet sitecore ser pushを実行して、例文をSitecoreインスタンスにプッシュします。
    

## MyProjectソリューションの作成

この手順では、MyProjectというJSSテナントを作成し、SXA機能を有効にします。

> !重要[SXAの指示](https://doc.sitecore.com/xp/en/developers/sxa/100/sitecore-experience-accelerator/managing-jss-apps-with-sxa.html)に従って、MyProjectというJSSテナントを作成し、cm.myproject.localhostホスト名の下にMyProjectというJSSサイトを付けてください。残りのSXAオプションはデフォルトのままにしておいて構いません。

MyProjectソリューションを作成するには:

1.  コンテンツエディターで /sitecore/Content/MyProject/MyProject/Settingsをクリックして、以下の手順を踏みます。
    -   **インポート**ユーザーをsitecore\\JssImportに設定します。
    -   **サーバー側のレンダリングエンジン**をhttpに設定してください。
    -   **サーバー側レンダリングエンジンのエンドポイントURL**をhttp://rendering/jss-renderに設定します。
2.  コンテンツツリーで/sitecore/Content/MyProjectをクリックし、**Presets**グループの**セキュリティ**タブで**JSS インポート - 上書きなし**をクリックします。**OK**をクリックします。
3.  コンテンツツリーで「/sitecore/Layout/Layouts/Project/MyProject/Main」をクリックし、**テンプレート**グループの**「構成**」タブで「**変更**」をクリックしてテンプレートを/sitecore/Templates/Foundation/JSS Experience Accelerator/Presentation/SXA JSS Layoutに設定します。
4.  /sitecore/Templates/Project/MyProject/App Routeをクリックし、**コンテンツ**タブの**ベーステンプレート**欄で/sitecore/Templates/Project/MyProject/Pageを追加します。
5.  /sitecore/Templates/Project/MyProject/App Route/\_\_Standard Valuesをクリックし、レイアウト**グループの****プレゼンテーション**タブで**詳細**をクリックしてください。
6.  **レイアウト詳細**ダイアログボックスで、デフォルトデバイスレイアウトを編集するには**編集**をクリックし、**レイアウト**タブでLayouts/Project/MyProject/Mainを選択し、その後**OK**をクリックして**デバイスエディタ**ダイアログボックスを閉じ、**OK**をクリックして**レイアウト詳細**ダイアログボックスを閉じます。
7.  /sitecore/Layout/Renderings/Project/MyProject/ContentBlockをクリックし、Experience Editorの「**その他のプロパティ**」を編集できます:
    -   IsAutoDatasourceRenderingをtrueの値で加算します。
    -   **データソースの位置**を空に設定してください。
8.  /sitecore/Layout/Placeholder Settings/Project/MyProject/MyProject-mainを/sitecore/content/MyProject/MyProject/Presentation/Placeholder Settingsに引きずり出せ。
9.  MyProject-mainプレースホルダー設定で、許可されたコントロールにRenderings\\Project\\MyProject\\ContentBlockを追加してください。
10.  /sitecore/Content/MyProject/MyProject/Homeを選択し、好きなタイトルとバナーを入力してください。
11.  /sitecore/content/MyProject/MyProject/Homeを右クリックして「**エクスペリエンスエディター**」をクリックすると、エクスペリエンスエディターのHomeページを開きます。
12.  ページの中央のプレースホルダーに **ContentBlock** を追加します。SXAは自動的にデータソースの項目を作成します。

すべてを公開し、レンダリングホストで自分の作品を閲覧してください。

## アイテムの復元とシリアル化

アイテムの復元とシリアル化:

1.  Items.module.configファイルに含まれるcontentを復元します:
    
    {
     "name": "content",
     "path": "/sitecore/content/MyProject"
    },
    
    > !注このステップは [「環境の準備](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--using-the-getting-started-template-with-sxa.html#UUID-a0ecd94a-cfef-b8fb-1c64-a32a8eabec29_section-idm232200890162617 "Prepare your environment") 」セクションの関連ステップの逆です。
    
2.  アイテムをディスクにシリアライズするには、dotnet sitecore ser pullを実行します。
    
3.  Content Managementロールを更新するには、Platformプロジェクトを公開してください。