Skip to main content
Design & Layout

Use Relative URLs for Links in Custom Content Boxes


pmo
Docebian
Forum|alt.badge.img+3
  • Docebian
  • 276 replies

Relative URLs and Custom Content Boxes

 

Let me know if this sounds familiar. Maybe you’re a new or existing Extended Enterprise customer and you’ve just built a custom page and linked to it with a custom content box on another page. You’ve just copied and pasted the URL into the custom content box and clicked save and you’re filled with excitement. Next thing you know you got an email from someone saying they’re getting a 404 error when they access the page. 

Or maybe you’re on pins and needles thinking about an upcoming change to your custom domain and you’re thinking “Oh no all of those URLs are going to break when we make the change”

Well strap in! You’ll love this trick. 

 

Here’s the current home page of DU chock full of custom content boxes. Let’s focus on the Docebo Learning Analytics Widget.
​​​​​And of course here’s where that URL inside the Custom Content Box settings. 



But what if I told you don’t have to (and probably shouldn’t) use the full URL?

 

Instead of using the full URL you can actually use what’s called a “relative URL” to populate the URL field inside of a custom content box. 

So using our example above: 


https://university.docebo.com/pages/118/docebo_learning_analytics

Becomes: 

/pages/118/docebo_learning_analytics


Why It Matters!

This is important because it future proofs your platform from any future domain changes as well as allows you to use the same page across multiple domains if you’re an extended enterprise client. It works because it will fill in the root domain of whatever domain the user logged into the LMS with which ensures they won’t see any of those pesky 403 or 404 errors

Did this post help you find an answer to your question?

15 replies

Annarose.Peterson
Hero III
Forum|alt.badge.img+6

Love this trick!  So Helpful, thank you!!!


  • Novice III
  • 9 replies
  • September 16, 2022

Does it works for the image widget too?


Bfarkas
Hero III
Forum|alt.badge.img+5
  • Hero III
  • 3582 replies
  • September 16, 2022
Gabriel wrote:

Does it works for the image widget too?

Yup, as long as you are on the same domain it will work for any links, it is a core behavior for websites. Relative link away!


Bfarkas
Hero III
Forum|alt.badge.img+5
  • Hero III
  • 3582 replies
  • September 16, 2022

Thanks for this excellent write up, it feels like this has come up in a lot of convos lately and is a thing I take understanding for granted too often. 


Alan
Guide I
Forum|alt.badge.img+2
  • Guide I
  • 170 replies
  • September 17, 2022

Hi @pmo @Bfarkas @Annarose.Peterson 

Something that folks need to be aware of is that relative links are not possible in the following places:

  - Learning Plan descriptions

  - HTML learning objects

When a relative link is used in the above containers, the LMS automatically (and silently) inserts the root domain, making them break for extended enterprise users. It’s quite a big problem for us, actually, because it completely prevents us from using links in these containers.

They do work in Course descriptions.  Hopefully it will be the same for the upcoming new LP experience!

Alan


Bfarkas
Hero III
Forum|alt.badge.img+5
  • Hero III
  • 3582 replies
  • September 17, 2022

Just to be clear that is an extended enterprise issue, works fine for those not using it in those places. 


James A
Novice III
  • Novice III
  • 16 replies
  • February 3, 2023

@Bfarkas @Alan 4 months later on….is there a solution to getting relative links to work within an html widget?? We’ve spent months just creating a set of pages to use across both extended enterprise branches only to realise just now that these relative links don’t work within these widgets.


Alan
Guide I
Forum|alt.badge.img+2
  • Guide I
  • 170 replies
  • February 6, 2023

Hi @James A 

Just to make sure we’re taking about the same thing, do you mean HTML learning objects or HTML page widgets? Relative links are supported by the latter, but not the former. 

Alan

 

 

 


James A
Novice III
  • Novice III
  • 16 replies
  • February 16, 2023

Hi @Alan, unless I’m mistaken having checked many times, it’s the latter (use in an html widget) that doesn’t seem to work across our enterprise branches. To clarify, we have one ‘main branch’ that has a root URL of https://companyA.docebosaas.com and an enterprise branch with a root URL of https://companyA.docebosaas.com/companyB. Where we use a relative link to a page (say we want to navigate to “/pages/245/marketing”) this only works for “CompanyA” users - i.e, it jumps to the URL https://companyA.docebosaas.com/pages/245/marketing). If you are from the “Company B” branch it doesn’t update the URL to “https://companyA.docebosaas.com/companyB/pages/245/marketing ” it simply uses “https://companyA.docebosaas.com/pages/245/marketing”.


kelly.newsome
Novice II
Forum|alt.badge.img

This was so incredibly helpful! Came here to search for tips for this issue with the image widget. You’ve made my day!


Forum|alt.badge.img
  • Influencer II
  • 41 replies
  • June 29, 2023

Sorry to revive and older thread/article. Does this also work for Enrollment Links? For example, keeping the “generatedby...” in the URL but removing the domain portion as stated at the end.


kelly.newsome
Novice II
Forum|alt.badge.img
dhall wrote:

Sorry to revive and older thread/article. Does this also work for Enrollment Links? For example, keeping the “generatedby...” in the URL but removing the domain portion as stated at the end.

I did this with a learning plan enrollment link and it worked just the same. I copied everything from /learn through to the end of the link (including the generatedby) and it worked with the image widget.


pmo
Docebian
Forum|alt.badge.img+3
  • Author
  • Docebian
  • 276 replies
  • July 3, 2023
dhall wrote:

Sorry to revive and older thread/article. Does this also work for Enrollment Links? For example, keeping the “generatedby...” in the URL but removing the domain portion as stated at the end.


@dhall 
No apologies necessary! We really like when people revive existing threads.

I just tested and this does in fact work for enrollment links as well.


Forum|alt.badge.img
  • Novice III
  • 22 replies
  • December 14, 2023
Alan wrote:

Hi @pmo @Bfarkas @Annarose.Peterson 

Something that folks need to be aware of is that relative links are not possible in the following places:

  - Learning Plan descriptions

  - HTML learning objects

When a relative link is used in the above containers, the LMS automatically (and silently) inserts the root domain, making them break for extended enterprise users. It’s quite a big problem for us, actually, because it completely prevents us from using links in these containers.

They do work in Course descriptions.  Hopefully it will be the same for the upcoming new LP experience!

Alan

Hi! I am with you on this one, it would be great if it also worked with LP description! @pmo Is this on the roadmap?

Thanks!


sjennings78
Guide II
Forum|alt.badge.img+4
  • Guide II
  • 175 replies
  • January 12, 2024

Thank you!  We’ve been slowly working on updating our links with the relative URLs so they all work correctly from our Sandbox next time we sync it.  And now that I’ve found out we will be changing the domain name soon, this will be a HUGE help!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings