question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I access the domain of a page or the absolute URL of an image?

See original GitHub issue

There are occasions where it’s necessary to generate absolute URLs, or at least determine the domain of a certain page.

For example with OpenGraph/Schema.org tags, the canonical URL of a page is necessary. This is possible with page.full_url(). However OpenGraph also requires an absolute URL for the og:image meta tag i.e an absolute URL for an image. How would that be generated? Perhaps, given that the image library is domain-agnostic, it would be better if there were an option to get the domain on it’s own, of any page viewed, so it could be prefixed to a relative image URL?

It feels like there’s a need for a page.get_site() (returning a Site) or similar, to make access easier for the non-technical.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

20reactions
Braintelligencecommented, Aug 25, 2016

@gasman Sorry for the misunderstanding. The issue is explicitly about this:

However OpenGraph also requires an absolute URL for the og:image meta tag

but I don’t see the solution presented, thus I can’t comprehend the solution. That’s why I thought I could ask for it here.

I will tend to the Google group then.

EDIT: For anyone who might stumble upon this and looking for a solution, you can do it like this:

{{ page.get_site.root_url }}{{ header_image.url }}

0reactions
gasmancommented, Aug 24, 2016

@Braintelligence Please use the Wagtail support Google group for support queries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find the URL of a page or image - Computer - Google Support
On your computer, go to google.com. · Search for the page. · At the top of your browser, click the address bar to...
Read more >
How do I access the domain of a page or the ... - Google Groups
I generate the url outside of the template and pass it as a context variable. for instance you could override get_context on your...
Read more >
How to Find the Codes or URLs for Web Images - ThoughtCo
Find the image you want. · Right-click that image (Ctrl+click on a Mac). Chrome right click on image · A menu will appear....
Read more >
How Absolute URLs vs Relative URLs work - Knowledge Center
For example, /images/img.jpg is telling the browser to go to the domain, then look for the images folder, then find the img.jpg file...
Read more >
Relative and absolute URLs - WebDevelopersNotes
gif located in the images directory, under www.webdevelopersnotes.com domain name. Similarly, the absolute URL of the document you are viewing is http://www.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found