テンプレートから作成マクロ
テンプレートから作成マクロは、ページにボタンを表示し、特定のテンプレートにリンクします。ボタンをクリックするとマクロがエディターを開き、新規ページ追加の準備が整い、所定のテンプレートに基づいてページへのコンテンツを追加します。
ページにマクロを追加する際は、ブループリントまたはユーザーが作成したテンプレートをマクロで指定できます。また、表示されるボタン、および新規ページが表示されるスペースの名前も指定できます。
例
スクリーンショット:3 つのボタンが表示されたページ - すべて「テンプレートからの作成マクロ」による表示
テンプレートから作成マクロマクロを使用する
ページにテンプレートから作成マクロマクロを追加するには:
- Confluence のエディタで、[挿入] > [その他のマクロ] を選択します。
- 対象のマクロを見つけて、選択します。
オートコンプリートでマクロエントリを高速化: タイプ{とマクロ名の先頭には、提案したマクロの一覧を表示します。詳細は、こちらを参照ください。リンク、ファイル、マクロ、メンションのオートコンプリート
既存のマクロを編集する方法: マクロのプレースホルダをクリックして、[編集] を選択します。マクロのパラメータが編集可能な場合、マクロのダイアログ ウィンドウが開きます。
パラメーター
Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example
).
パラメーター | 必須 | 既定 | 説明 |
---|---|---|---|
Button Text | 'Create from Template' | ページ上で表示されるマクロの説明。 | |
Template Name | なし | 新規ページのベースとなるテンプレートまたはブループリントを選択します。現在のスペースに対しグローバルおよびユーザーが作成したテンプレートのみが表示されます(「スペース キー」欄で異なるスペースを指定してる場合は除く) | |
Template Title | 空白 | このマクロを使用して作成したページに既定値のタイトルを指定します(任意)。タイトルには、変数; @currentDate、@spaceName、@spaceKey を使用できます。 | |
Space Key | 現在のページが作成されているスペース | 一意のスペース識別子(スペース キー)を与え、マクロを使用してページを作成する際に新規ページが作成される場所を特定します。 |
コードの例
次の例は、Confluence ページの基本的なマークアップを調べたり、編集したりする上級ユーザー向けに提供されています。
Macro name: create-from-template
マクロ本体: なし。
格納形式用のパラメーターは、以下のマクロブラウザで有効なパラメーターと異なります。
パラメーター名 | 必須 | 既定 | パラメーターの説明と指定可能な値 |
---|---|---|---|
| ユーザーが作成したテンプレートに必須 | (なし) | The ID of a user-created template. This is the unique identifier that Confluence assigns when you create a template. For example, 299630593 . To find the ID of a template, edit the template and look at the URL in your browser. The template ID is given in the URL parameter named entityId . |
blueprintModuleCompleteKey | ブループリントに必須 | (なし) | |
| はい | (なし) | The ID of a user-created template (for example, 299630593 ) or the qualified name of the add-on that defines the blueprint (for example, com.atlassian.confluence.plugins.confluence-shared-files-plugin:file-list-blueprint
). |
buttonLabel | はい | 'Create from Template' | ページ上で表示されるマクロの説明。 |
spaceKey | はい | 現在のページが作成されているスペース | マクロを使用してページを作成する際に新規ページが作成される場所を特定するための、一意のスペース識別子(スペース キー)。 |
Title | いいえ | (なし) | The title for pages created using this macro. You can include @currentDate , @spaceName and @spaceKey variables in the title. This title will override any title specified in a blueprint template. |
保存形式の例
この例では、ユーザーが作成したテンプレートを指定しています。
<ac:structured-macro ac:name="create-from-template">
<ac:parameter ac:name="templateId">299630593</ac:parameter>
<ac:parameter ac:name="buttonLabel">Blitz test</ac:parameter>
<ac:parameter ac:name="spaceKey">
<ri:space ri:space-key="DOCTHEME"/>
</ac:parameter>
<ac:parameter ac:name="templateName">299630593</ac:parameter>
</ac:structured-macro>
この例ではブループリントを使用しています。
<ac:structured-macro ac:name="create-from-template">
<ac:parameter ac:name="blueprintModuleCompleteKey">com.atlassian.confluence.plugins.confluence-shared-files-plugin:file-list-blueprint</ac:parameter>
<ac:parameter ac:name="buttonLabel">Shared files</ac:parameter>
<ac:parameter ac:name="spaceKey">
<ri:space ri:space-key="DOCTHEME"/>
</ac:parameter>
<ac:parameter ac:name="templateName">com.atlassian.confluence.plugins.confluence-shared-files-plugin:file-list-blueprint</ac:parameter>
</ac:structured-macro>
Wiki マークアップ
このマクロでは Wiki マークアップは使用できません。Wiki マークアップを使用して、このマクロを追加することはできません。