/// <summary>
        /// Gets the url segment for a specified content and culture.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="culture">The culture.</param>
        /// <returns>
        /// The url segment.
        /// </returns>
        /// <remarks>
        /// This is for when Umbraco is capable of managing more than one url
        /// per content, in 1-to-1 multilingual configurations. Then there would be one
        /// url per culture.
        /// </remarks>
        public string GetUrlSegment(IContentBase content, CultureInfo culture)
        {
            if (content.GetContentType().Alias != "realEstate")
            {
                return(null);
            }

            var segment = _provider.GetUrlSegment(content);

            return($"{content.GetValue("type")}-{content.GetValue<string>("city")}-{segment}".ToUrlSegment());
        }
Exemplo n.º 2
0
        public string GetUrlSegment(IContentBase content, string culture = null)
        {
            if (content.ContentType.Alias != "productPage")
            {
                return(null);
            }
            var segment    = provider.GetUrlSegment(content, culture);
            var productSku = content.GetValue(propertyTypeAlias: "productSku", culture: culture, segment: null, published: true);

            return(string.Format("{0}-{1}", segment, productSku));
        }
Exemplo n.º 3
0
        public string GetUrlSegment(IContentBase content, CultureInfo culture)
        {
            // only for product doctypes
            var productContentType = PublishedContentModels.Product.ModelTypeAlias;

            if (content.GetContentType().Alias != productContentType)
            {
                return(null);
            }

            var segment = _provider.GetUrlSegment(content);

            // Watch the "ToUrlSegment()"
            var productName = content.GetValue <string>("productName")?.ToUrlSegment();

            return($"{segment}-{productName}");
        }