Publish Later feature, Tags - This week in Orchard (13/03/2020)

Gábor Domonkos's avatar
Announcement, This week in Orchard, Recipes

The Tags feature is now merged to the dev branch of Orchard Core! In our post, you can also read about the improvements of the Content Picker field, see a demo about the Publish Later module and many more!

Orchard Core updates

Make content picker default to displaying all content types when none are selected

There is no reasonable use-case for a content picker to be configured with no DisplayedContentTypes other than it just hasn't been configured yet. On the other hand, it seems reasonable that some circumstances may necessitate picking a content item of an undeterminable content type at setup.

So, by using the content picker you could select which content types you wanted to display in the list when you are searching for a content item. Now there is a new option which is called DisplayAllContentTypes. This way when you add a new content type you won't have to select it again when specifying the content types to display in your content picker.

To try this out just simply add a new Content Picker Field to your type and then head to the settings page of the field. Here you can find the Display All Content Types checkbox, that we have just mentioned before. Put a tick in this box and then create a new content item of your content type. We have added a Content Picker Field to a Page content type. Here you could see that the list of the picker is showing menus, landing pages (named Orchard Core) and page content items, so, everything is here that we have defined on our tenant.


The tags PR was merged to the dev branch of Orchard Core. The editor of it shows the list of taxonomy terms as tags and stores every DisplayText of every taxonomy term that is tagged inside the field itself under a custom dynamic property which is not available on the field class itself, but there are extension methods called GetTagNames and SetTagNames to retrieve and set the name of the tags.

There is a property on the field itself (on the JSON document of the field) that's called TagNames, that gets all the tag names as a string array based on the DisplayText, when a tag was added to the content item. If you change the DisplayText of a term, then every existing content item that was tagged with this term won't have the new DisplayText. That's a caveat for using this property, the GetTagNames on the field. But it would be super useful when you want to just list the names of tags and the TagNames never change, which they should never do. Don't change the name of the tag from one day to the other. If you do, then your responsibility to update the content items or not to use the TagNames property, but resolve all the content items for every tag and use a dynamic DisplayText.

Maybe we want the same possibility on even the default TaxonomyField. And have that property on the field itself as a static property, by explaining the limitation of this property.

You can see great demos on YouTube about tags using taxonomies and Open Tags. We have already mentioned these demos in the following This week in Orchard posts:

Fix for SameSite cookie issue

By following the recommendation of the ASP.NET team, now we are checking that based on the browser vendor ID what default value we should send for the SameSite cookie. Most of the servers never set the SameSite property of the cookie. It used to be a default value like None by default. But now Google assumes that no value will mean Lax. So, if you want to keep the None value (that was before by default) we have to set it. There is an update on the ASP.NET framework that set's it by default but there is configuration to change the behavior. But this behavior should not change for some browsers that won't be updated. And this is why the only solution is to check what kind of browser is doing the request to know what value we need to set as the default, like Unspecified, None or Lax or whatever. That's an issue and this is done now.

Maintain content item ID across BagPart.ContentItems

Before this code every time you would change the elements of a BagPart (even updating some properties), it would regenerate some content item JSON payload for each of the BagPart items, which means the content item IDs would be unique, but new. And it would cause issues when you do workflows or when you do routing for containers. Now the content item IDs are immutable even for BagParts.

Recipe properties step

There is a new deployment step called Recipe File that lets you define customized properties of the recipe file. If you want to customize the recipe file you have this step and then you will be able to set the properties that you can see on the screen.


Publish Later module

In the admin UI, head to the Configuration -> Features and enable the Publish Later feature. This module adds the ability to schedule content items to be published at a given future date and time. If you would like to use this feature with your content type you have to edit its definition by attaching the Publish Later Part to it. Let's attach the Publish Later Part to the Blog Post content type! Now create a new blog post!

At the bottom of the editor, you will see a new input Tag Helper with the datetime-local input type. If you set the date and the time here and hit the Publish Later button, the current version will be saved as a draft and at the given time it will be automatically published by using a background task. We also have a Cancel Publish Later button, so we can cancel the publishing process from here. And in the SummaryAdmin list, you also had a little message that shows you the date and time when the content item will be published.

If you are interested in the full demo, don't forget to watch the YouTube video about it!

This contribution is sponsored by a company called Weiss Ratings.

News from the community

How we are dealing with the coronavirus pandemic?

In light of WHO characterizing the Coronavirus outbreak as a pandemic we wanted to disclose how we're dealing with the issue:

Orchard Dojo Newsletter

Now we have 124 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment