ホームページ
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ホームページは、1 つ以上のコンテキストに依存しないカードを定義できる Google Workspace アドオンの新しい機能です。コンテキストに依存しないカードは、ユーザーが特定のコンテキストの外部にいるときにユーザー インターフェースを表示するために使用されます。たとえば、ユーザーが Gmail の受信トレイを表示しているが、メールや下書きを開いていないときなどです。
ホームページでは、クイック アクセス サイドパネル の Google アプリ(Keep、カレンダー、ToDo リスト)と同様に、コンテキストに依存しないコンテンツを表示できます。ホームページは、ユーザーがアドオンを初めて開く際の最初の開始点にもなります。また、新しいユーザーにアドオンの操作方法を教えるのにも役立ちます。
アドオンのホームページを定義するには、プロジェクト マニフェストでホームページを指定し、1 つ以上の homepageTrigger
関数を実装します(ホームページの設定をご覧ください)。
アドオンが拡張するホスト アプリケーションごとに 1 つずつ、複数のホームページを設定できます。また、カスタム ホームページを指定していないホストで使用される、共通のデフォルト ホームページを 1 つ定義することもできます。
アドオンのホームページは、次のいずれかの条件が満たされると表示されます。
- ホストでアドオンが初めて開かれたとき(承認後)。
- アドオンが開いているときに、ユーザーがコンテキスト コンテキストから非コンテキスト コンテキストに切り替えた場合。たとえば、カレンダーの予定の編集からメインのカレンダーに移動します。
- ユーザーが [戻る] ボタンを何度かクリックして、内部スタックから他のすべてのカードをポップしたとき。
- コンテキストに依存しないカードの UI 操作で
Navigation.popToRoot()
呼び出しが発生した場合。
ホームページの設計は必須ではありませんが、強くおすすめします。ホームページを定義しない場合、ユーザーがホームページに移動するたびに、アドオン名を含む汎用カードが使用されます。
ホームページの設定
Google Workspace アドオンは、addOns.common.homepageTrigger
フィールドを使用して、アドオンのマニフェスト内のすべてのホスト アプリケーションのデフォルトのホームページ(コンテキストに依存しない)アドオン コンテンツを構成します。
{
// ...
"addOns": {
// ...
"common": {
// ...
"homepageTrigger": {
"runFunction": "myFunction",
"enabled": true
}
}
}
}
runFunction
: Google Workspace アドオン フレームワークがホームページ アドオン カードのレンダリング時に呼び出す Apps Script 関数の名前。この関数はホームページ トリガー関数です。この関数は、ホームページ UI を構成する Card
オブジェクトの配列を構築して返す必要があります。複数のカードが返された場合、ホスト アプリケーションには、ユーザーが選択できるカードのヘッダーがリストに表示されます(複数のカードを返すをご覧ください)。
enabled
: このスコープでホームページ カードを有効にするかどうか。このフィールドは省略可能で、デフォルト値は true
です。これを false
に設定すると、すべてのホストでホームページ カードが無効になります(そのホストでオーバーライドしない限り。下記を参照)。
共通の構成に加えて、各ホスト アプリケーションの構成(addOns.gmail.homepageTrigger
、addOns.calendar.homepageTrigger
など)で使用できる、ホストごとのオーバーライドも同じ構造で存在します。
{
...
"addOns": {
...
"common": {
// By default, call 'buildHomePage' to render homepage content
// in all hosts. Since calendar.homepageTrigger below overrides
// this in Calendar and Drive and the homepageTrigger is disabled
// for Gmail, this homepage function never executes.
"homepageTrigger": { "runFunction": "buildHomePage" }
},
"calendar": {
// Show customized homepage content for Calendar only.
"homepageTrigger": { "runFunction": "buildCalendarHomepage" }
},
"drive": {
// Show customized homepage content for Drive only.
"homepageTrigger": { "runFunction": "buildDriveHomepage" }
}
"gmail": {
// Disable homepage add-on content in Gmail.
"homepageTrigger": { "enabled": false }
},
...
}
}
これは、次のマニフェストの抜粋と同じです。
{
...
"addOns": {
...
"common": { /* ... */ }, // Omitted a default homepageTrigger specification.
"calendar": {
// Show customized homepage content for Calendar only.
"homepageTrigger": { "runFunction": "myCalendarFunction" }
},
"drive": {
// Show customized homepage content for Drive only.
"homepageTrigger": { "runFunction": "myDriveFunction" }
}
"gmail": { /* ... */ },
...
}
}
homepageTrigger
セクションはどれも必須ではありません。ただし、特定のホスト プロダクトでアドオンに表示される UI は、対応するマニフェスト フィールドの有無と、関連する homepageTrigger
があるかどうかによって異なります。次の例は、さまざまなマニフェスト構成のホームページ UI を作成するために実行されるアドオン トリガー関数(存在する場合)を示しています。

ホームページ イベント オブジェクト
上記のホームページ トリガー関数(runFunction
)が呼び出されると、呼び出しコンテキストのデータを含むイベント オブジェクトが渡されます。
ホームページ イベント オブジェクトには、ウィジェットやコンテキスト情報は含まれません。渡される情報は、次の共通イベント オブジェクトのフィールドに限定されます。
commonEventObject.clientPlatform
commonEventObject.hostApp
commonEventObject.userLocale
と commonEventObject.userTimezone
(ただし、制限情報についてはユーザーの言語 / 地域とタイムゾーンへのアクセスをご覧ください)。
詳細については、イベント オブジェクトをご覧ください。
コンテキストに依存しないその他のカード
アドオンの UI には、ホームページではないコンテキストに依存しないカードを追加できます。たとえば、ホームページにボタンがあり、そのボタンをクリックすると [設定] カードが開き、ユーザーがアドオンの設定を調整できる場合、その設定はコンテキストに依存しない(コンテキストに依存しない)設定である可能性があります。
コンテキストに依存しないカードは、他のカードと同様に作成されます。唯一の違いは、カードを生成し表示するアクションまたはイベントです。カード間の遷移を作成する方法については、ナビゲーション メソッドをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-01 UTC。
[null,null,["最終更新日 2025-08-01 UTC。"],[[["\u003cp\u003eHomepages in Google Workspace add-ons display non-contextual content, similar to built-in apps like Keep and Calendar, offering a starting point for users.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the homepage content by specifying a homepage trigger function in your add-on's manifest, potentially creating different homepages for each supported host application.\u003c/p\u003e\n"],["\u003cp\u003eAdd-ons can have multiple non-contextual cards, with the homepage acting as the primary entry point and other cards serving specific functions, such as settings or help.\u003c/p\u003e\n"],["\u003cp\u003eAlthough not mandatory, designing a homepage is recommended to improve the user experience, as a generic card is used otherwise.\u003c/p\u003e\n"],["\u003cp\u003eHomepage triggers are invoked without contextual information, relying on limited event object fields like client platform, host application, user locale, and timezone.\u003c/p\u003e\n"]]],["Google Workspace add-ons can utilize \"homepages,\" which are non-contextual cards displayed when users are outside a specific context or first open an add-on. Developers define homepages in the project manifest using `homepageTrigger` functions, which generate the UI. Multiple homepages can be specified for different host applications, or a default one can be used. Homepages are triggered when the add-on opens, transitions out of context, or navigates to the root. It's highly recommended to create a homepage, else a basic card is used.\n"],null,["# Homepages\n\n*Homepages* are a new Google Workspace add-ons feature\nthat provides the ability to define one or more *non-contextual cards*.\nNon-contextual cards are used to display a user interface when the user is\noutside a specific context, such as when the user is viewing their Gmail inbox\nbut hasn't opened a message or draft.\n\nHomepages let you show non-contextual content, just like the\nGoogle apps in the\n[quick-access side panel](https://workspaceupdates.googleblog.com/2018/08/use-quick-access-side-panel-to-do-more.html)\n(Keep, Calendar, and Tasks). Homepages can also provide an initial starting\nplace for when a user first opens your add-on, and are useful for teaching\nnew users how to interact with your add-on.\n\nYou can define a homepage for your add-on by specifying it in your project\nmanifest and implementing one or more `homepageTrigger` functions (see\n[Homepage configuration](#homepage_configuration)).\n\nYou can have multiple homepages, one for each host application that your add-on\nextends. You can also decide to define a single common default homepage that is\nused in hosts where you haven't specified a custom homepage.\n\nYour add-on homepage is displayed when one of the following conditions are met:\n\n- When the add-on is first opened in the host (after authorization).\n- When the user switches from a contextual context to a non-contextual context while the add-on is open. For example, from editing a Calendar event to the main Calendar.\n- When the user clicks the back button enough times to [pop every other card off of the internal stacks](/workspace/add-ons/how-tos/navigation).\n- When a UI interaction in a non-contextual card results in a [`Navigation.popToRoot()`](/apps-script/reference/card-service/navigation#popToRoot()) call.\n\nDesigning a homepage isn't mandatory but highly recommended; if you do not define any, a generic card\ncontaining your add-on name is used whenever a user would otherwise navigate\nto the homepage.\n\nHomepage configuration\n----------------------\n\nGoogle Workspace add-ons use the\n[`addOns.common.homepageTrigger`](/apps-script/manifest/addons#Common.FIELDS.homepageTrigger)\nfield to configure the default homepage (non-contextual) add-on content for\nall host applications in the add-on\n[manifest](/workspace/add-ons/concepts/workspace-manifests): \n\n {\n // ...\n \"addOns\": {\n // ...\n \"common\": {\n // ...\n \"homepageTrigger\": {\n \"runFunction\": \"myFunction\",\n \"enabled\": true\n }\n }\n }\n }\n\n- `runFunction`: The name of the Apps Script function that the\n Google Workspace add-ons framework invokes to render homepage add-on cards.\n This function is the *homepage trigger function* . This function must build\n and return an array of [`Card`](/apps-script/reference/card-service/card)\n objects that make up the homepage UI. If more than one card is returned, the\n host application shows the card headers in a list that the user can select\n from (see\n [Returning multiple cards](/workspace/add-ons/how-tos/navigation#returning_multiple_cards)).\n\n- `enabled`: Whether homepage cards should be enabled for this scope. This\n field is optional, and defaults to `true`. Setting this to `false` causes\n homepage cards to be disabled for all hosts (unless overridden for that\n host; see below).\n\n| **Note:** In order for a host to use the common homepage, both [`addOns.common.homepageTrigger`](/apps-script/manifest/addons#Common.FIELDS.homepageTrigger) and the host's top-level resource must be present in the add-on [manifest](/workspace/add-ons/concepts/workspace-manifests). For example, if [`addOns.gmail`](/apps-script/manifest/addons#AddOns.FIELDS.gmail) isn't present in the manifest, then the add-on is disabled for Gmail and will not show a homepage (or any other functionality in that host).\n\nIn addition to the common configuration, there are also\nidentically-structured per-host overrides available in each host application's\nconfig, at `addOns.gmail.homepageTrigger`, `addOns.calendar.homepageTrigger`,\nand so forth: \n\n {\n ...\n \"addOns\": {\n ...\n \"common\": {\n // By default, call 'buildHomePage' to render homepage content\n // in all hosts. Since calendar.homepageTrigger below overrides\n // this in Calendar and Drive and the homepageTrigger is disabled\n // for Gmail, this homepage function never executes.\n \"homepageTrigger\": { \"runFunction\": \"buildHomePage\" }\n },\n \"calendar\": {\n // Show customized homepage content for Calendar only.\n \"homepageTrigger\": { \"runFunction\": \"buildCalendarHomepage\" }\n },\n \"drive\": {\n // Show customized homepage content for Drive only.\n \"homepageTrigger\": { \"runFunction\": \"buildDriveHomepage\" }\n }\n \"gmail\": {\n // Disable homepage add-on content in Gmail.\n \"homepageTrigger\": { \"enabled\": false }\n },\n ...\n }\n }\n\nNote that this is equivalent to the following manifest excerpt: \n\n {\n ...\n \"addOns\": {\n ...\n \"common\": { /* ... */ }, // Omitted a default homepageTrigger specification.\n \"calendar\": {\n // Show customized homepage content for Calendar only.\n \"homepageTrigger\": { \"runFunction\": \"myCalendarFunction\" }\n },\n \"drive\": {\n // Show customized homepage content for Drive only.\n \"homepageTrigger\": { \"runFunction\": \"myDriveFunction\" }\n }\n \"gmail\": { /* ... */ },\n ...\n }\n }\n\nNone of the `homepageTrigger` sections are required. However, the UI shown for\nan add-on in any given host product depends on the presence of the\ncorresponding manifest field, and whether there's an associated\n`homepageTrigger`. The following example shows which add-on trigger functions\nare executed (if any) to create a homepage UI for different manifest\nconfigurations:\n\n### Homepage event objects\n\nWhen called, the homepage trigger function (`runFunction`) described above is\npassed an [event object](/workspace/add-ons/concepts/event-objects)\ncontaining data from the invocation context.\n\nHomepage event objects don't include widget or contextual information; the\ninformation passed is limited to the following\n[common event object](/workspace/add-ons/concepts/event-objects#common_event_object)\nfields:\n\n- `commonEventObject.clientPlatform`\n- `commonEventObject.hostApp`\n- `commonEventObject.userLocale` and `commonEventObject.userTimezone` (but see [Accessing user locale and timezone](/workspace/add-ons/how-tos/access-user-locale) for restriction information).\n\nSee [Event object](/workspace/add-ons/concepts/event-objects) for more details.\n\nOther non-contextual cards\n--------------------------\n\nYour add-on UI can contain additional non-contextual cards that aren't\nhomepages. For example, your homepage might have a button that opens a\n\"Settings\" card where the user can adjust the add-on settings (such settings\nwould, in most cases, be independent of context and therefore non-contextual).\n\nNon-contextual cards are built like any other card; the only difference is\nwhat action or event generates and displays the card. See\n[Navigation methods](/workspace/add-ons/how-tos/navigation#navigation_methods)\nfor details on how to create transitions between cards."]]