But is seems it takes some 1/2 seconds every time the page loads - is there a simple, faster way to do it ?
Something similar to @Model.Content.UrlWithDomain() ?
(btw, the @urlRequest.Scheme://@[email protected] works well for other thing I need it - for the twitter card, but for the facebook button I only need something quick and simple)
UrlWithDomain() in Umbraco 11
Hi,
In my Umbraco 7 I got the page url the following:
(I need it for the facebook share button in a page
It doesn't work in Umbraco 11, so I did something like:
First injecting
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor _httpContextAccessor
then
@urlRequest.Scheme://@[email protected]
as Huw Reddick suggestedSo I have
But is seems it takes some 1/2 seconds every time the page loads - is there a simple, faster way to do it ?
Something similar to
@Model.Content.UrlWithDomain()
?(btw, the
@urlRequest.Scheme://@[email protected]
works well for other thing I need it - for the twitter card, but for the facebook button I only need something quick and simple)Thanks
Hi Meni,
you can use this extension method Eg:
@Model.Url(mode:UrlMode.Absolute)
As Dhanesh said
is the normal way to go. But if you're using a strongly typed content model, say in a block, that won't work. You'll need to use this:
Thanks! work.
is working on a reply...