Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Please add Vorto support for URL_Names #11

Open
lele7 opened this issue May 26, 2015 · 10 comments
Open

Please add Vorto support for URL_Names #11

lele7 opened this issue May 26, 2015 · 10 comments
Assignees

Comments

@lele7
Copy link

lele7 commented May 26, 2015

like discussed:

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

@ryanlewis
Copy link
Owner

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 ryanlewis self-assigned this Jun 1, 2015
@ryanlewis
Copy link
Owner

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.

@lele7
Copy link
Author

lele7 commented Jun 2, 2015

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...

@ryanlewis
Copy link
Owner

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.

@lele7
Copy link
Author

lele7 commented Jun 2, 2015

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?

@ryanlewis
Copy link
Owner

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.

@lele7
Copy link
Author

lele7 commented Jun 2, 2015

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);
    }
}

}

@ryanlewis
Copy link
Owner

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.

@lele7
Copy link
Author

lele7 commented Jun 2, 2015

In that case it sounds bad :(

@ryanlewis
Copy link
Owner

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

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants