How do I access the domain of a page or the absolute URL of an image?
See original GitHub issueThere 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:
- Created 9 years ago
- Comments:9 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gasman Sorry for the misunderstanding. The issue is explicitly about this:
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 }}
@Braintelligence Please use the Wagtail support Google group for support queries.