/// <summary> /// Get the tree for a slug. /// </summary> /// <param name="slug">The slug for which to get the tree.</param> /// <returns>The tree of parent.</returns> public static IEnumerable <string> GetTree(string slug) { var slugInstance = new Slug(slug); string[] segments = slugInstance.Split(); if (segments.Length == 0) { yield break; } var sb = new StringBuilder(); foreach (string segment in segments) { sb.Append(segment); if (sb.Length > 0) { sb.Append("/"); } yield return(sb.ToString()); } }
/// <summary> /// Gets a parition key string for <see cref="Content"/> and related items from a slug. /// </summary> /// <param name="slug">The slug from which to get the partition key.</param> /// <returns>The partition key for the slug.</returns> public static string GetPartitionKeyFromSlug(string slug) { string normalisedSlug = new Slug(slug).ToString(); return(normalisedSlug.Base64UrlEncode()); }