Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeffrey Weinstein 67 posts 313 karma points
    Jun 10, 2022 @ 14:15
    Jeffrey Weinstein
    0

    When page have several cultures it is not returned by IPublishedContentQuery

    Hello,

    when I call ContentAtRoot() from IPublishedContentQuery it only returns pages which are not multilanguage.

    Any idea how to make it return all content?

  • Jeffrey Weinstein 67 posts 313 karma points
    Jun 10, 2022 @ 17:29
    Jeffrey Weinstein
    100

    If there will be some other ignorant like me, searching for answers be advised you have to set VariationContext on the IVariationContextAccessor.

    And you can iterate thru available languages via ILocalizationService.GetAllLanguages()

    so than my implementation looks like this

    var languages = localizationService.GetAllLanguages();
    var items = languages.SelectMany(language =>
    {
        _variationContextAccessor.VariationContext = new VariationContext(language.IsoCode);
        return publishedContentQuery.ContentAtRoot();
    }).ToArray();
    
Please Sign in or register to post replies

Write your reply to:

Draft