Hi, yes you can. But not without affecting the URLs to the articles. We usually create year- and month containers that are automatically created when a new article is published. So the article's URL will contain these containers URL segments as well, e.g. /articles/2018/01/the-article.
Sorry, can't share our source code for that. Haven't seen any blog posts either covering this functionality. But it's very straight forward to implement. In worst case scenario you can let the editors create these containers themselves.
Yeah sure no source code but I haven't seen any blog or tutorial for this thing. Any headsup for what to do?
To start with you need something like this:
[ContentType( GUID = "f9a9c0c8-829e-487e-aec7-1abcf77613fc")] [AvailableContentTypes( Availability.Specific, IncludeOn = new[] { typeof(HomePage) }, Include = new[] { typeof(NewsArticlePage), typeof(NewsContainerPage) })] public class NewsArchivePage : PageData { public override void SetDefaultValues(ContentType contentType) { base.SetDefaultValues(contentType); this[MetaDataProperties.PageChildOrderRule] = FilterSortOrder.Index; } } [ContentType( GUID = "8a400614-12b9-482c-919b-a3cf57b5133e" AvailableInEditMode = false)] [AvailableContentTypes( Availability.Specific, Include = new[] { typeof(NewsContainerPage), typeof(NewsArticlePage) })] public class NewsContainerPage : PageData { public override void SetDefaultValues(ContentType contentType) { base.SetDefaultValues(contentType); this[MetaDataProperties.PageChildOrderRule] = FilterSortOrder.PublishedDescending; } } [ContentType( GUID = "85e2f4e1-eec3-4e69-bb89-712d9184b1e3")] [AvailableContentTypes(Availability.None)] public class NewsArticlePage : PageData { }
Then you need to create an initializable module and listen to content events and then create the containers when a news article is published. There should be articles on how to create such module and subscribe to content events. There is also code examples in the documentation here on World on how to create content programatically.
Hello,
Is there a way that I can put all pages of same page types inside a folder? I am going to have articles and if I don't put them inside a folder or organize them somehow it will be very hard to maintain.
Regards