diff --git a/13/umbraco-cms/SUMMARY.md b/13/umbraco-cms/SUMMARY.md index 40db911916c..b18a38d75c5 100644 --- a/13/umbraco-cms/SUMMARY.md +++ b/13/umbraco-cms/SUMMARY.md @@ -353,6 +353,7 @@ * [TextService](reference/management/services/textservice.md) * [ContentService](reference/management/services/contentservice/README.md) * [Create content programmatically](reference/management/services/contentservice/create-content-programmatically.md) + * [Publish content programmatically](reference/management/services/contentservice/publish-content-programmatically.md) * [ContentTypeService](reference/management/services/contenttypeservice/README.md) * [Retrieving content types](reference/management/services/contenttypeservice/retrieving-content-type-containers.md) * [Retrieving content types](reference/management/services/contenttypeservice/retrieving-content-types.md) diff --git a/13/umbraco-cms/reference/configuration/contentsettings.md b/13/umbraco-cms/reference/configuration/contentsettings.md index 405348bcb0a..8d266b172f8 100644 --- a/13/umbraco-cms/reference/configuration/contentsettings.md +++ b/13/umbraco-cms/reference/configuration/contentsettings.md @@ -49,7 +49,8 @@ The following snippet will give an overview of the keys and values in the conten "PreviewBadge": "My HTML here]]>", "ResolveUrlsFromTextString": false, "ShowDeprecatedPropertyEditors": false, - "ShowDomainWarnings": true + "ShowDomainWarnings": true, + "ShowUnroutableContentWarnings": true } } } @@ -176,7 +177,7 @@ This setting is used for controlling whether or not the Data Types marked as obs By default this is set to `false`. To make the obsolete data types visible in the dropdown change the value to `true`. -### Show Domain Warnings +### Show domain warnings If you do not configure Domains for each language in a multilingual site then every time you publish your content you get this warning: @@ -184,7 +185,15 @@ If you do not configure Domains for each language in a multilingual site then ev If you have a use case for not setting the domains, you can set this setting **ShowDomainWarnings** to `false` to stop the warning from displaying. -## ContentVersionCleanupPolicy +### Show unroutable content warnings + +If your routing setup leads to more than one document having the same URL, on publish a warning will be displayed: + +`Content published: The document does not have a URL, possibly due to a naming collision with another document. More details can be found under Info.` + +To suppress these warnings, set this option to `false`. + +## Content version cleanup policy The global settings for the scheduled job which cleans historic content versions. These settings can be overridden per Document Type. @@ -202,7 +211,7 @@ See [Content Version Cleanup](../../fundamentals/data/content-version-cleanup.md To retain only the current draft and published version, set both the "keep" settings values to 0. The next time the scheduled job runs (hourly) all non-current versions (except those marked "prevent cleanup") will be removed. -### EnableCleanup +### Enable cleanup When set to `true`, a scheduled job will delete historic content versions that are not retained according to the policy every hour. @@ -210,11 +219,11 @@ When set to `false`, the scheduled job will not delete any content versions, reg The dotnet new template provides an `appsettings.json` file with the default value set to `true` for all sites. -### KeepAllVersionsNewerThanDays +### Keep all versions newer than days All versions that fall in this period will be kept. -### KeepLatestVersionPerDayForDays +### Keep latest version per day for days For content versions that fall in this period, the most recent version for each day is kept. All previous versions for that day are removed unless marked as preventCleanup. @@ -239,11 +248,11 @@ This section is used for managing how Umbraco handles images, allowed attributes Let's break it down. -### ImageFileTypes +### Image file types This is a separated list of accepted image formats -### AutoFillImageProperties +### Auto fill image properties You can define what properties should be automatically updated when an image is being uploaded. This means that if you decide to rename the default **umbracoWidth** and **umbracoHeight** properties the values in **`"WidthFieldAlias"`** and **`"HeightFieldAlias"`** need to be updated. This needs to happen in order to automatically populate the values when the image is being uploaded. diff --git a/13/umbraco-cms/reference/management/services/contentservice/publish-content-programmatically.md b/13/umbraco-cms/reference/management/services/contentservice/publish-content-programmatically.md new file mode 100644 index 00000000000..649e3c5b6f3 --- /dev/null +++ b/13/umbraco-cms/reference/management/services/contentservice/publish-content-programmatically.md @@ -0,0 +1,35 @@ +# Publishing content programmatically + +The ContentService is also used for publishing operations. + +The following example shows a page being published with all descendants. + +```csharp +using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Services; + +namespace Umbraco.Cms.Web.UI.Custom; + +public class PublishContentDemo +{ + private readonly IContentService _contentService; + + public PublishContentDemo(IContentService contentService) => _contentService = contentService; + + public void Publish(Guid key) + { + IContent? content = _contentService.GetById(key) + ?? throw new InvalidOperationException($"Could not find content with key: {key}."); + + _contentService.SaveAndPublishBranch(content, PublishBranchFilter.Default); + } +} +``` + +The `PublishBranchFilter` option can include one or more of the following flags: + +- `Default` - publishes existing published content with pending changes. +- `IncludeUnpublished` - publishes unpublished content and existing published content with pending changes. +- `ForceRepublish` - publishes existing published content with or without pending changes. +- `All` - combines `IncludeUnpublished` and `ForceRepublish`. + diff --git a/13/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/creating-saving-and-publishing-content.md b/13/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/creating-saving-and-publishing-content.md index 53b440365b9..d83158741a6 100644 --- a/13/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/creating-saving-and-publishing-content.md +++ b/13/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/creating-saving-and-publishing-content.md @@ -65,8 +65,7 @@ To publish the node with descendants, follow these steps: 3. Select **Publish with descendants**. ![Publish with descendants](../../../../../10/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/images/Publish-with-descendants-v9.png) -4. Toggle the option to **Include unpublished content items** if you wish to. This option includes all unpublished content items for the selected page and the available linked pages. - +4. Toggle the option to **Include unpublished content items** if you wish to. This option includes all unpublished content items for the selected page and the descendant pages. ![Publish with descendants](../../../../../10/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/images/Publish-with-descendants2-v9.png) #### 3: Unpublish