Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IDocumentUrlAliasService

    Defines operations for handling document URL aliases (umbracoUrlAlias property).

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IDocumentUrlAliasService

    Methods

    View Source

    CreateOrUpdateAliasesAsync(Guid)

    Creates or updates the aliases for a single document.

    Declaration
    Task CreateOrUpdateAliasesAsync(Guid documentKey)
    Parameters
    Type Name Description
    Guid documentKey

    The document key.

    Returns
    Type Description
    Task
    View Source

    CreateOrUpdateAliasesWithDescendantsAsync(Guid)

    Creates or updates the aliases for a document and its descendants.

    Declaration
    Task CreateOrUpdateAliasesWithDescendantsAsync(Guid documentKey)
    Parameters
    Type Name Description
    Guid documentKey

    The document key.

    Returns
    Type Description
    Task
    View Source

    DeleteAliasesFromCacheAsync(IEnumerable<Guid>)

    Deletes all aliases from the cache for a collection of document keys.

    Declaration
    Task DeleteAliasesFromCacheAsync(IEnumerable<Guid> documentKeys)
    Parameters
    Type Name Description
    IEnumerable<Guid> documentKeys

    The collection of document keys.

    Returns
    Type Description
    Task
    View Source

    GetAliasesAsync(Guid, string?)

    Gets all URL aliases for a given document.

    Declaration
    Task<IEnumerable<string>> GetAliasesAsync(Guid documentKey, string? culture)
    Parameters
    Type Name Description
    Guid documentKey

    The document key.

    string culture

    The culture code (null for default language).

    Returns
    Type Description
    Task<IEnumerable<string>>

    All aliases for the document in the specified culture, or empty if none found.

    View Source

    GetDocumentKeysByAliasAsync(string, string?)

    Gets all document keys that match a given URL alias.

    Declaration
    Task<IEnumerable<Guid>> GetDocumentKeysByAliasAsync(string alias, string? culture)
    Parameters
    Type Name Description
    string alias

    The URL alias (normalized: lowercase, no leading slash).

    string culture

    The culture code (null for invariant).

    Returns
    Type Description
    Task<IEnumerable<Guid>>

    All document keys that have the specified alias, or empty if none found.

    View Source

    HasAny()

    Checks whether any aliases are cached.

    Declaration
    bool HasAny()
    Returns
    Type Description
    bool

    true if there are any aliases in the cache; otherwise, false.

    View Source

    InitAsync(bool, CancellationToken)

    Initializes the service and ensures the alias cache is populated from the database.

    Declaration
    Task InitAsync(bool forceEmpty, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    bool forceEmpty

    Forces an early return when we know there are no aliases (i.e. on install).

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task
    View Source

    RebuildAllAliasesAsync()

    Rebuilds all URL aliases from the database.

    Declaration
    Task RebuildAllAliasesAsync()
    Returns
    Type Description
    Task
    Remarks

    This method clears the existing alias cache and database records, then rebuilds from the umbracoUrlAlias property values on all documents.

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