> Can you be more specific about which pages demonstrate the problem?
Sure! I made an example page to show the issue, and tested it on
firefox, chrome, and safari. It is the same behaviour across the board.
check out:
https://solarpunk.cool/example
And to audit the code:
https://git.sr.ht/~zim/solarpunk.cool/tree/canon/item/example
As the page shows, relative links (whether for navigation, external
stylesheets, or images) do not work as expected. Only absolute paths
work. Also, links that open in a new tab do not work.
The relative paths and links work when viewing the page locally. I also
uploaded this folder to another site(hosted by nearlyfreespeech.net),
and the relative paths work as expected there too:
https://coolguy.website/example
It seems to be an issue with the srht.site page, but am not sure what it
could be.
Thank you!
On Sun, 2021-03-07 at 17:30 +1300, Zach! wrote:
> > Can you be more specific about which pages demonstrate the problem?> > Sure! I made an example page to show the issue, and tested it on > firefox, chrome, and safari. It is the same behaviour across the board.> > check out:> https://solarpunk.cool/example> > And to audit the code:> https://git.sr.ht/~zim/solarpunk.cool/tree/canon/item/example
<view-source:https://solarpunk.cool/example> seems to be the same as the
code in the repo as well (although I only used my eyes).
> As the page shows, relative links (whether for navigation, external > stylesheets, or images) do not work as expected. Only absolute paths > work. Also, links that open in a new tab do not work.
I tested it in lynx, elinks, and w3m. All of them worked with the _blank
links, which means it's probably an issue with a more modern feature of
HTTP.
--
u9000 (Nine)
They, Them, Theirs
Hi!
> As the page shows, relative links (whether for navigation, external> stylesheets, or images) do not work as expected. Only absolute paths work.> Also, links that open in a new tab do not work.> > The relative paths and links work when viewing the page locally. I also> uploaded this folder to another site(hosted by nearlyfreespeech.net), and> the relative paths work as expected there too:> https://coolguy.website/example
Hm... This page[1] on my site includes an image that is inserted from
a relative path and there's never been a problem with it.
W3C's (X)HTML5 validator shows there are errors in your HTML code,
though.[2] I think my intuition isn't far too off if I tell you the
problem seems to be that you're relying on some undefined behavior.
Hope this helps!
[1]: https://ariadnavigo.xyz/bio
[2]: https://html5.validator.nu/?doc=https%3A%2F%2Fsolarpunk.cool%2Fexample&showimagereport=yes
--
Ariadna Vigo
(she/her)
Web: <https://ariadnavigo.xyz>
PGP: 0xA3B1324836A669BD
On Sun Mar 7, 2021 at 6:12 AM EST, Simon Ser wrote:
> It seems to be related to the CSP. target="_blank" requires> allow-popups [1].
I think I'm fine with prohibiting this, it's not a very good behavior.
It looks like the issue with the relative links is that when you navigate to /example, when the browser fetches astyle.css it will load /astyle.css instead of /example/astyle.css.
If you navigate instead to /example/ your page works as expected (other than the CSP issue).
It looks like the nearly free speech site is redirecting /example to /example/, so thats why its working correctly there.
> Hm... This page[1] on my site includes an image that is inserted from
> a relative path and there's never been a problem with it.
I checked your page, https://ariadnavigo.xyz/bio, on my phone and
desktop, using firefox, chrome, and safari. Unfortunately, your
profile image does
not load for me. Your site reinforces my issue, actually, that the
page is trying
to load:
https://ariadnavigo.xyz/ari.jpg#center
instead of:
https://ariadnavigo.xyz/bio/ari.jpg#center
> W3C's (X)HTML5 validator shows there are errors in your HTML code,
Good catch with the w3c spec. I updated the site so it now passes
(except for a
warning about the content-security policy):
https://validator.w3.org/nu/?doc=https%3A%2F%2Fsolarpunk.cool%2Fexample
but my issue persists :(
On 3/7/21 10:28 PM, Ariadna Vigo wrote:
> Hi!>>> As the page shows, relative links (whether for navigation, external>> stylesheets, or images) do not work as expected. Only absolute paths work.>> Also, links that open in a new tab do not work.>>>> The relative paths and links work when viewing the page locally. I also>> uploaded this folder to another site(hosted by nearlyfreespeech.net), and>> the relative paths work as expected there too:>> https://coolguy.website/example> Hm... This page[1] on my site includes an image that is inserted from> a relative path and there's never been a problem with it.>> W3C's (X)HTML5 validator shows there are errors in your HTML code,> though.[2] I think my intuition isn't far too off if I tell you the> problem seems to be that you're relying on some undefined behavior.>> Hope this helps!>> [1]: https://ariadnavigo.xyz/bio> [2]: https://html5.validator.nu/?doc=https%3A%2F%2Fsolarpunk.cool%2Fexample&showimagereport=yes>
> Yeah, the issue isn't pages, it's your markup. Your HTML needs to be> fixed.
I may not be the best at this, but could you see where my markup needs
to be fixed?
According to the w3c validator, there is no issue in the markup of the
example page.
link:
https://validator.w3.org/nu/?doc=https%3A%2F%2Fsolarpunk.cool%2Fexample
As Ben Burwell pointed out, If I set the address to be
https://solarpunk.cool/example/ ,
the page loads as expected.
I tried setting the relative links for the boombox image as both
'boombox.svg' and './boombox.svg',
but neither worked for me. Is there a meta tag or some other setting I
am missing? Is it possible
to have https://solarpunk.cool/example automatically redirect to
https://solarpunk.cool/example/ ?
On 3/8/21 9:56 AM, Drew DeVault wrote:
> Yeah, the issue isn't pages, it's your markup. Your HTML needs to be> fixed.
The markup validates, but it's wrong. Your URL needs to point to the
appropriate address. The image is not at the location you have put into
the src attribute.
> The markup validates, but it's wrong. Your URL needs to point to the
appropriate address
I've updated my example to show the issue I'm having:
https://solarpunk.cool/example
The images will only load if I go to:
https://solarpunk.cool/example/
or if i go to:
https://solarpunk.cool/example/index.html
---
It is likely that site visitors will not remember to add a trailing
slash when visiting parts of the page.
Coincidentally, I received an email this morning from someone reporting
that https://solarpunk.cool/zines/web-zine-01
was broken (of course, https://solarpunk.cool/zines/web-zine-01/ works
fine).
Is it expected that I should add only absolute paths throughout the site
to anticipate someone
forgetting to add a trailing slash, or is it possible to have this
redirect built
into the server? I am fine if the answer is the former, I just wanted
to know if it's an issue in how
I'm using relative links, or if I needed to adjust my assumptions on how
sourcehut pages work.
On 3/8/21 10:05 AM, Drew DeVault wrote:
> The markup validates, but it's wrong. Your URL needs to point to the> appropriate address. The image is not at the location you have put into> the src attribute.
Please see RFC 3986, section 5.4 for the semantic. IMHO a static server
should not perform redirection in this case and it's up to the generator
(machine or human) to use absolute URLs.
Drew DeVault transcribed 0.1K bytes:
> Yeah, the issue isn't pages, it's your markup. Your HTML needs to be> fixed.
Right, so instead of saying the markup is wrong, why not just confirm
that pages does not support this kind of relative path?
Even w3schools says that putting "picture.jpg" is for when "The
"picture.jpg" file is located in the same folder as the current page"[0]
I looked at the server.go for pages, and you could check for a relative
path (r.URL.IsAbs() == false) in the request, and then concatenate
accordingly...
Having relative paths like this is useful because it allows you to
resuse your html pages on multiple sites, hosts, etc, without needing to
regenerate or edit your markup.
I'm not sure if you have followed the entire thread, but please take a
look at RFC 3986, section 5.4 for URL joining rules: it might not be
what you have in mind.
That's not how the web works. We'd have to redirect /example to
/example/ for the URLs to match like that. The browser doesn't know if
it's a file or a directory.
Except that <a href="./two.html"> should work, and it apparently wasn't,
though I cannot confirm anymore since solarpunk.cool/example is not
hosted on sourcehut pages now.
Take a look at the source on ietf RFC viewer:
https://tools.ietf.org/html/rfc3986
There are relative links (eg. <a href="./rfc2732">) and that works fine.
Drew DeVault transcribed 0.2K bytes:
> That's not how the web works. We'd have to redirect /example to> /example/ for the URLs to match like that. The browser doesn't know if> it's a file or a directory.
By your logic, ./rfc2732 would points to
https://tools.ietf.org/html/rfc3986/rfc2732,
were the base URL a directory (which in this case it isn't,
it's an alias for rfc3986.html).
I think the take away message here is, if you're building a static site
generator, please generate absolute URLs, otherwise use one if you
cannot cover all scenarios. One helpful sanity check would be a dummy
static server like python -m http.server to check your hand-crafted
site.
Nguyễn Gia Phong transcribed 0.5K bytes:
> By your logic, ./rfc2732 would points to> https://tools.ietf.org/html/rfc3986/rfc2732,> were the base URL a directory (which in this case it isn't,> it's an alias for rfc3986.html).
You're right, my mistake.
Okay, so what about redirecting to "<path>" to "<path>/"?
I assume there is pushback on this for some reason, no?