The CLI publish command
The Sitecore publishing plugin includes a publish
command. This command publishes Sitecore Items.
To install the publishing plugin, run the following code:
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Publishing
Usage
You can use the command as follows:
dotnet sitecore publish [options]
Options
You can use the following options with the publish
command:
Option |
Required |
Description |
---|---|---|
|
No |
The Sitecore environment to use. Default: |
|
No |
Path to root |
|
No |
Comma-separated list of languages to publish. If unspecified, all languages are published. |
|
No |
Deprecated. Sitecore item path or GUID to smart publish. If unspecified, then the entire database is published. |
|
No |
Use republish. If unspecified, then smart-publish is used instead. |
|
No |
List of target databases to publish. If unspecified, it publishes to the default publishing target (the first one in the list). |
|
No |
Report additional diagnostic and performance data. |
|
No |
Report additional diagnostic and performance data. |
|
No |
Help for the command. |
Examples
The following are examples of the publish
command use:
Command |
Result |
---|---|
Attempt to publish from the
|
Does not publish Sitecore items and returns the message: |
Attempt to publish from the
|
Publishes the Sitecore items from the folder |
|
Publishes Sitecore items to the environment with the name |
|
Publishes Sitecore items for only the specified languages ( |
|
Deprecated. See the item subcommand. Publishes only the item with path /sitecore/content/Home/Test Item. |
|
Publishes items to the |
|
Creates additional diagnostic and performance data, such as root config path or count of nodes with performance, for example, 73ms (8.1ms/node). |
|
Creates additional diagnostic and performance data, such as FSIndex: Loaded filesystem indexes in, for example, 70ms (9 metadatas) or created package of 1 trees in, for example, 1983ms (9 items; 220.3ms/node). |
Subcommands
The publish
command has the following subcommands:
-
list-targets
- displays all the publishing targets defined for an environment. -
item
- publishes a single item.
The list-targets subcommand
The list-targets
subcommand reads and lists all publishing targets defined for a Sitecore environment. The list-targets
subcommand requires elevated permissions.
You can run the command as follows:
dotnet sitecore publish list-targets [options]
You can use the following options with the list-targets
subcommand:
Option |
Required |
Description |
---|---|---|
|
No |
Path to root Default: current working directory. |
|
No |
Named Sitecore environment to use. Default: |
|
No |
Write additional diagnostic and performance data. |
|
No |
Write additional diagnostic and performance data. |
|
No |
|
The item subcommand
The item
subcommand publishes a single item. The item
subcommand requires elevated permissions.
You can run the command as follows:
dotnet sitecore publish item [options]
You can use the following options with the item
subcommand:
Option |
Required |
Description |
---|---|---|
|
No |
The Sitecore environment to use. Default: |
|
No |
Path to root Default: cwd. |
|
No |
Comma-separated list of languages to publish. If unspecified, all languages are published. |
|
No |
Sitecore item path or GUID to smart publish. |
|
No |
Use republish. If unspecified, then smart-publish is used instead. |
|
No |
List of target databases to publish. If unspecified, it publishes to the default publishing target (the first one in the list). |
|
No |
Publish subitems. Default: |
|
No |
Publish related items. Default: |
|
No |
Report additional diagnostic and performance data. |
|
No |
Report additional diagnostic and performance data. |
|
No |
Help for the command. |
For example, to publish a single item, including its subitems and related items, you run the following command:
dotnet sitecore publish item --path /sitecore/content/Home -sub -rel