2

How can I get the current DNN Logo file's Absolute URL Path?

Currently, Google picks up the Relative Path. /Portals/2/Images/logo.png

I need the full path with the domain name.

I want something almost like: PortalSettings.PortalAlias.PortalID

The Google Structured Data Tool gives the following path after I have added itemprop="logo" to the logo.ascx file found under Admin/Skins in DNN.

enter image description here

enter image description here

VDWWD
  • 35,079
  • 22
  • 62
  • 79
Tig7r
  • 525
  • 1
  • 4
  • 21
  • 1
    If the output in Google’s SDTT is your only concern: You don’t need to provide the full URL; every consumer will use the document base URL to end up with the correct, full URL. In the SDTT, Google shows their own base URL because the tool runs there. – unor Sep 20 '18 at 13:47
  • Thanks for explaining the base URL part. I think the Output is not my only concern. I think Google won't detect the Logo URL as the path only actually starts at /Portals/Images/2/Logo.png – Tig7r Sep 20 '18 at 14:20
  • 1
    If you have something like ``, and the image displays in the browser, every Microdata consumer will be able to work with it. – unor Sep 20 '18 at 16:22

2 Answers2

1

I came up with the following code, but I only still need the protocol which will be http:// or https://

The code below will generate dnndev.me/Portals/2/Images/logo.png

I just need to figure out how to get the protocol. I am sure the code below can be simplified.

PortalLogoPath = PortalSettings.Current.PortalAlias.HTTPAlias + PortalSettings.HomeDirectory + PortalSettings.LogoFile;
Tig7r
  • 525
  • 1
  • 4
  • 21
0
PortalLogoPath = HttpContext.Current.Request.Url.Scheme + "://" + PortalSettings.Current.PortalAlias.HTTPAlias + PortalSettings.HomeDirectory + PortalSettings.LogoFile;
MDM
  • 897
  • 6
  • 12