seo-metadata icon indicating copy to clipboard operation
seo-metadata copied to clipboard

Please add Vorto support for URL_Names

Open lele7 opened this issue 9 years ago • 10 comments

like discussed:

https://our.umbraco.org/projects/backoffice-extensions/seo-metadata-for-umbraco/please-use-github-issues/64969-URL-rewrite

lele7 avatar May 26 '15 09:05 lele7

Had a little look into this at the minute. I'm not entirely sure this is currently possible as the current culture doesn't seem to be available at publish time to the IUrlSegmentProvider (I need to dig into the core a little further to see what's up).

I'll spend a little more time on this tomorrow.

ryanlewis avatar Jun 01 '15 16:06 ryanlewis

I've written a post on our.umbraco.org regarding these issues.

https://our.umbraco.org/forum/developers/api-questions/65242-UrlSegmentProviders-and-the-current-culture-(SEO-Metadata-playing-nice-with-Vorto)

At the moment the core doesn't make it possible for the UrlSegmentProvider to grab the current culture for the page with respect to I suspect that this won't be resolved soon, unfortunately.

What I'm considering doing is adding a boolean option to disable/enable the URL name renaming section being rendered. This will allow you to implement your own implementation of the URL segment provider using a standard textstring property and then use SEO Metadata with Vorto.

ryanlewis avatar Jun 02 '15 10:06 ryanlewis

Hi Ryan Thank you for your help. Did you saw this post?

https://our.umbraco.org/projects/backoffice-extensions/vorto/bugs-feedback-suggestions/53831-Is-it-possible-to-use-vorto-with-umbracoUrlName

Maybe it could helping you...

lele7 avatar Jun 02 '15 10:06 lele7

I saw that and that's what I've been looking into. What Matt suggested is exactly what SEO Metadata is doing currently. Unfortunately that method cannot get the current culture so I cannot get the relevant version from the Vorto data.

ryanlewis avatar Jun 02 '15 11:06 ryanlewis

You said you always receiving the same language "en-GB". I think this is your backend Users language, but if you logged out you couldn't get the right language at the frontend?

lele7 avatar Jun 02 '15 11:06 lele7

The request pipeline does. The problem is that you are configuring the URL name, which is a publishing/backoffice thing and not a content thing.

ryanlewis avatar Jun 02 '15 12:06 ryanlewis

And something like that don't work?

using System; using System.Collections.Generic; using System.Linq; using System.Web; using Umbraco.Core.Strings; using Vorto.Extension

namespace ids.Umb.Mvc { public class LocalisedUrlSegmentProvider : IUrlSegmentProvider { readonly IUrlSegmentProvider _provider = new DefaultUrlSegmentProvider();

    public string GetUrlSegment(Umbraco.Core.Models.IContentBase content, System.Globalization.CultureInfo culture)
    {
        string rVal = content.GetVortoValue<string>(URL_PropertyName, culture.ToString());
        if (String.IsNullOrEmpty(rVal))
        {
            rVal = _provider.GetUrlSegment(content);
        }
        return rVal;
    }

    public string GetUrlSegment(Umbraco.Core.Models.IContentBase content)
    {
        return GetUrlSegment(content, System.Threading.Thread.CurrentThread.CurrentCulture);
    }
}

}

lele7 avatar Jun 02 '15 12:06 lele7

GetVortoValue is an extension method for IPublishedContent, where content in this case is IContentBase. The GetVortoValue() method also uses Thread.CurrentThread.CurrentUICulture.

GetVortoValue is intended to be used at render time.

ryanlewis avatar Jun 02 '15 12:06 ryanlewis

In that case it sounds bad :(

lele7 avatar Jun 02 '15 12:06 lele7

Looks like this issue will have to wait until v8 of the Core until it is resolved.

http://issues.umbraco.org/issue/U4-7130

ryanlewis avatar Sep 25 '15 15:09 ryanlewis