diff --git a/src/Umbraco.Abstractions/Routing/IPublishedUrlProvider.cs b/src/Umbraco.Abstractions/Routing/IPublishedUrlProvider.cs
new file mode 100644
index 0000000000..a26f3efaff
--- /dev/null
+++ b/src/Umbraco.Abstractions/Routing/IPublishedUrlProvider.cs
@@ -0,0 +1,110 @@
+using System;
+using System.Collections.Generic;
+using Umbraco.Core;
+using Umbraco.Core.Models.PublishedContent;
+
+namespace Umbraco.Web.Routing
+{
+ public interface IPublishedUrlProvider
+ {
+ ///
+ /// Gets or sets the provider url mode.
+ ///
+ UrlMode Mode { get; set; }
+
+ UrlMode GetMode(bool absolute);
+ IPublishedContent GetDocument(int id);
+ IPublishedContent GetDocument(Guid id);
+ IPublishedContent GetMedia(Guid id);
+
+ ///
+ /// Gets the url of a published content.
+ ///
+ /// The published content identifier.
+ /// The url mode.
+ /// A culture.
+ /// The current absolute url.
+ /// The url for the published content.
+ string GetUrl(Guid id, UrlMode mode = UrlMode.Default, string culture = null, Uri current = null);
+
+ ///
+ /// Gets the url of a published content.
+ ///
+ /// The published content identifier.
+ /// The url mode.
+ /// A culture.
+ /// The current absolute url.
+ /// The url for the published content.
+ string GetUrl(int id, UrlMode mode = UrlMode.Default, string culture = null, Uri current = null);
+
+ ///
+ /// Gets the url of a published content.
+ ///
+ /// The published content.
+ /// The url mode.
+ /// A culture.
+ /// The current absolute url.
+ /// The url for the published content.
+ ///
+ /// The url is absolute or relative depending on mode and on current.
+ /// If the published content is multi-lingual, gets the url for the specified culture or,
+ /// when no culture is specified, the current culture.
+ /// If the provider is unable to provide a url, it returns "#".
+ ///
+ string GetUrl(IPublishedContent content, UrlMode mode = UrlMode.Default, string culture = null, Uri current = null);
+
+ string GetUrlFromRoute(int id, string route, string culture);
+
+ ///
+ /// Gets the other urls of a published content.
+ ///
+ /// The published content id.
+ /// The other urls for the published content.
+ ///
+ /// Other urls are those that GetUrl would not return in the current context, but would be valid
+ /// urls for the node in other contexts (different domain for current request, umbracoUrlAlias...).
+ /// The results depend on the current url.
+ ///
+ IEnumerable GetOtherUrls(int id);
+
+ ///
+ /// Gets the other urls of a published content.
+ ///
+ /// The published content id.
+ /// The current absolute url.
+ /// The other urls for the published content.
+ ///
+ /// Other urls are those that GetUrl would not return in the current context, but would be valid
+ /// urls for the node in other contexts (different domain for current request, umbracoUrlAlias...).
+ ///
+ IEnumerable GetOtherUrls(int id, Uri current);
+
+ ///
+ /// Gets the url of a media item.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ string GetMediaUrl(Guid id, UrlMode mode = UrlMode.Default, string culture = null, string propertyAlias = Constants.Conventions.Media.File, Uri current = null);
+
+ ///
+ /// Gets the url of a media item.
+ ///
+ /// The published content.
+ /// The property alias to resolve the url from.
+ /// The url mode.
+ /// The variation language.
+ /// The current absolute url.
+ /// The url for the media.
+ ///
+ /// The url is absolute or relative depending on mode and on current.
+ /// If the media is multi-lingual, gets the url for the specified culture or,
+ /// when no culture is specified, the current culture.
+ /// If the provider is unable to provide a url, it returns .
+ ///
+ string GetMediaUrl(IPublishedContent content, UrlMode mode = UrlMode.Default, string culture = null, string propertyAlias = Constants.Conventions.Media.File, Uri current = null);
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Infrastructure/Routing/UrlInfo.cs b/src/Umbraco.Abstractions/Routing/UrlInfo.cs
similarity index 100%
rename from src/Umbraco.Infrastructure/Routing/UrlInfo.cs
rename to src/Umbraco.Abstractions/Routing/UrlInfo.cs
diff --git a/src/Umbraco.Web/IUmbracoContext.cs b/src/Umbraco.Web/IUmbracoContext.cs
index a37c70dfc7..7609ad6b01 100644
--- a/src/Umbraco.Web/IUmbracoContext.cs
+++ b/src/Umbraco.Web/IUmbracoContext.cs
@@ -65,7 +65,7 @@ namespace Umbraco.Web
///
/// Gets the url provider.
///
- UrlProvider UrlProvider { get; }
+ IPublishedUrlProvider UrlProvider { get; }
///
/// Gets/sets the PublishedRequest object
diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs
index 8720d4c52a..693482db76 100644
--- a/src/Umbraco.Web/Routing/UrlProvider.cs
+++ b/src/Umbraco.Web/Routing/UrlProvider.cs
@@ -8,15 +8,16 @@ using Umbraco.Web.Composing;
namespace Umbraco.Web.Routing
{
+
///
/// Provides urls.
///
- public class UrlProvider
+ public class UrlProvider : IPublishedUrlProvider
{
#region Ctor and configuration
///
- /// Initializes a new instance of the class with an Umbraco context and a list of url providers.
+ /// InitialiIUrlProviderzes a new instance of the class with an Umbraco context and a list of url providers.
///
/// The Umbraco context.
/// Routing settings.
@@ -72,10 +73,10 @@ namespace Umbraco.Web.Routing
#region GetUrl
- private UrlMode GetMode(bool absolute) => absolute ? UrlMode.Absolute : Mode;
- private IPublishedContent GetDocument(int id) => _umbracoContext.Content.GetById(id);
- private IPublishedContent GetDocument(Guid id) => _umbracoContext.Content.GetById(id);
- private IPublishedContent GetMedia(Guid id) => _umbracoContext.Media.GetById(id);
+ public UrlMode GetMode(bool absolute) => absolute ? UrlMode.Absolute : Mode;
+ public IPublishedContent GetDocument(int id) => _umbracoContext.Content.GetById(id);
+ public IPublishedContent GetDocument(Guid id) => _umbracoContext.Content.GetById(id);
+ public IPublishedContent GetMedia(Guid id) => _umbracoContext.Media.GetById(id);
///
/// Gets the url of a published content.
@@ -138,7 +139,7 @@ namespace Umbraco.Web.Routing
return url?.Text ?? "#"; // legacy wants this
}
- internal string GetUrlFromRoute(int id, string route, string culture)
+ public string GetUrlFromRoute(int id, string route, string culture)
{
var provider = _urlProviders.OfType().FirstOrDefault();
var url = provider == null
diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs
index 5f2f43d61f..07310e8a5c 100644
--- a/src/Umbraco.Web/UmbracoContext.cs
+++ b/src/Umbraco.Web/UmbracoContext.cs
@@ -134,7 +134,7 @@ namespace Umbraco.Web
///
/// Gets the url provider.
///
- public UrlProvider UrlProvider { get; }
+ public IPublishedUrlProvider UrlProvider { get; }
///
/// Gets/sets the PublishedRequest object