The Content by Label macro lists content which has been tagged with specific labels.

On this page:

Usage with the Macro Browser

To insert the content by label macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you've found the content by label macro, click 'insert' to add it to your page.

Usage with the Wiki Markup Editor

To display all pages with the label needs-fixing, use:

{contentbylabel:label=needs-fixing|showLabels=false|showSpace=false|maxResults=99|space=@self}

Below is a working example of the 'Content by Label' macro. In the example, we have restricted the display to 5 results. By default, Confluence lists all the labels for each result displayed. See the optional parameters below for more information.

パラメーター

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

パラメーター

既定

説明

(author)

なし

Filter the results by author. The macro will display only the pages etc which are written or updated by the author(s) you specify here.

You can specify one or more authors, separated by a comma.

Label(s)
(label) or (labels)

なし

This parameter is required.

Use this parameter to filter the results by label. The macro will display only the pages etc which are tagged with the label(s) you specify here.

You can specify one or more label values, separated by a comma or a space.

  • To exclude content which matches a given label, put a minus sign (-) immediately in front of that label value. For example: If you specify a label value of -badpage you will get only content which is not labelled with 'badpage'.
  • 特定のラベル値を持つ結果のみを指定するには、ラベル値のすぐ前にプラス記号 (+) を追加します。例: ラベル値を +superpage,+goodpage と指定すると、少なくとも "superpage" と "goodpage" の 2 つのラベルを持つコンテンツのみを取得できます。

Maximum Number of Pages
(max) or (maxResults)

15

表示される結果の最大数を指定します。結果は最初にソートされ、その後、最大のパラメータが適用されることにご注意ください。

(operator)

または

The operator to apply to the supplied lists of labels. By default, a page with any of the non-prefixed labels (that is, labels without a plus (+) or minus (-) sign immediately preceding it) will be listed. By using operator=AND, only pages with all of the supplied non-prefixed labels will be listed.

(info) Be aware that this parameter only modifies the behaviour of the 'Label(s)' parameter and only affects label values without a plus (+) or minus (-) sign prefix. To avoid confusion or unexpected results, it is not recommended that the operator parameter be used in conjunction with any label values prefixed with '+' or '-' signs.

Show Labels for Each Page
(showLabels)

true

Show or hide labels for results.

Show Space Name for Each Page
(showSpace)

true

Show or hide spaces for results.

Reverse Sort
(reverse)

false

Use this parameter in conjunction with the sort parameter described below. Set reverse=true to change the sort from ascending to descending.

(info) this parameter is ignored if the sort parameter is not specified.

Sort By
(sort)

modified

Specify how the results should be sorted. To change the sort order from ascending to descending, use the reverse parameter described above.

Note: If this parameter is not specified, the sort order defaults to descending order based on the last modification date.

Values:

  • creation — Sort by the date on which the content was added.
  • title — Sort alphabetically by title.
  • modified — Sort by the date on which the content was last updated.

Restrict to these Spaces
(space) or (spaces)

@all, i.e. all spaces in your Confluence site.

This parameter allows you to filter content by space. The macro will display only the pages etc. which belong to the space(s) you specify here.

You can specify one or more space keys, separated by a comma or a space.

  • 特定のスペースのコンテンツを除外するには、スペース キーのすぐ前にマイナス記号 (-) を追加します。例: スペース キーを -BADSPACE と指定すると、BADSPACE に含まれないコンテンツのみを取得できます。
  • 特定のスペースのコンテンツのみを指定するには、スペース キーのすぐ前にプラス記号 (+) を追加します。例: スペース キーを +GOODSPACE と指定すると、GOODSPACE のコンテンツのみを取得できます (各コンテンツ項目は 1 つのスペースにのみ所属するため、このオプションが有効な麺は少ないことにご注意ください。1 つのスペース キーの前にプラス記号を設定してほかのスペース キーを一覧に追加した場合、追加したスペース キーは無視されます)。

特別な値:

  • @self — 現在のスペース。
  • @personal — All personal spaces.
  • @global — All global spaces.
  • @favorite — The spaces you have marked as favourite.
  • @favourite — 上記の @favorite と同様。
  • @all — Confluence サイトのすべてのスペース。
  • * — 上記の @all と同様。

(info) When specifying a personal space, remember to use the tilde (~) sign in front of the username, such as ~jbloggs or ~jbloggs@example.com.

List Title
(title)

なし

Adds a title or heading to the list.

Include these Content Types Only
(type)

すべて

このパラメータを使用すれば、コンテンツ タイプでコンテンツを絞り込むことができます。ここで指定したコンテンツ タイプのみがマクロで表示されます。

カンマまたはスペース区切りで複数のタイプを指定できます。

特定のコンテンツ タイプのコンテンツを除外するには、そのコンテンツ タイプのすぐ前にマイナス記号 (-) を追加します。例: コンテンツ タイプを -blogpost と指定すると、ページと、ブログ投稿を除くその他すべてのコンテンツを取得できます。

利用可能な値:

  • pagePages.
  • blogpost or newsBlog posts, also known as news items.

Display Excerpts
(excerpt)

false

Displays excerpts for each page listed in the Content by Label macro. Note that you must define the excerpts on each of those pages, by adding the excerpt macro to each page. If a particular page does not have an excerpt defined, then the Content by Label macro will not attempt to show an excerpt for that page. The Content by Label macro will show only the first few lines of the excerpt for each page.

1. Show content from a specific space

{contentbylabel:label=dogs,cats|space=PETS}

2. Show only results in current space

{contentbylabel:label=dogs,cats|space=@self}

3. Show results from all spaces

{contentbylabel:label=dogs,cats|space=@all}

4. Show only content of a specified type

The code below will show only pages (but not blog posts or other content types) with the labels 'dogs' or 'cats':

{contentbylabel:label=dogs,cats|type=page}

5. Do not show the labels in the results

{contentbylabel:label=dogs,cats|showLabels=false}

6. Do not show the space names in the results

{contentbylabel:label=dogs,cats|showSpace=false}

7. Display excerpts in the results

{contentbylabel:label=dogs,cats|excerpt=true}

8. Specify the maximum number of results to display

{contentbylabel:label=dogs,cats|max=99}

9. Sort by modification date

{contentbylabel:label=dogs,cats|sort=modified}

10. Change the sort order

{contentbylabel:label=dogs,cats|sort=modified|reverse=true}
関連トピック

Related Labels Macro
Navmap Macro
Recently Used Labels Macro
Working with Labels
Working with Macros

Take me back to the Confluence User's Guide.