November Happy Hour will be moved to Thursday December 5th.

Organizing pages

Vote:
 

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

#187480
Jan 24, 2018 11:06
Vote:
 

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.

#187483
Jan 24, 2018 12:50
Vote:
 

Thanks for the response, do you have link to that? 

#187484
Jan 24, 2018 12:52
Vote:
 

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.

#187485
Jan 24, 2018 12:55
Vote:
 

Yeah sure no source code but I haven't seen any blog or tutorial for this thing. Any headsup for what to do? 

#187486
Jan 24, 2018 12:59
Vote:
 

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.

#187487
Edited, Jan 24, 2018 13:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.