Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentBaseExtensions

    Provides extension methods to IContentBase to get URL segments.

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class ContentBaseExtensions

    Methods

    View Source

    GetUrlSegment(IContentBase, IShortStringHelper, IEnumerable<IUrlSegmentProvider>, string?, bool)

    Gets a single URL segment for a specified content and culture.

    Declaration
    public static string? GetUrlSegment(this IContentBase content, IShortStringHelper shortStringHelper, IEnumerable<IUrlSegmentProvider> urlSegmentProviders, string? culture = null, bool published = true)
    Parameters
    Type Name Description
    IContentBase content

    The content.

    IShortStringHelper shortStringHelper
    IEnumerable<IUrlSegmentProvider> urlSegmentProviders
    string culture

    The culture.

    bool published

    Whether to get the published or draft.

    Returns
    Type Description
    string

    The URL segment.

    Remarks

    If more than one URL segment provider is available, the first one that returns a non-null value will be returned.

    View Source

    GetUrlSegments(IContentBase, IShortStringHelper, IEnumerable<IUrlSegmentProvider>, string?, bool)

    Gets all URL segments for a specified content and culture.

    Declaration
    public static IEnumerable<string> GetUrlSegments(this IContentBase content, IShortStringHelper shortStringHelper, IEnumerable<IUrlSegmentProvider> urlSegmentProviders, string? culture = null, bool published = true)
    Parameters
    Type Name Description
    IContentBase content

    The content.

    IShortStringHelper shortStringHelper
    IEnumerable<IUrlSegmentProvider> urlSegmentProviders
    string culture

    The culture.

    bool published

    Whether to get the published or draft.

    Returns
    Type Description
    IEnumerable<string>

    The collection of URL segments.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX