~sircmpwn/sr.ht-discuss

21 9

Re: [pages] Behaviour of Links

Details
Message ID
<fc729915-55f3-eff5-e345-c1fb0560a41b@coolguy.website>
DKIM signature
missing
Download raw message
 > 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!

Re: [pages] Behaviour of Links

Details
Message ID
<5358daf4af53c154650dee206d6a29dc0c450672.camel@posteo.mx>
In-Reply-To
<fc729915-55f3-eff5-e345-c1fb0560a41b@coolguy.website> (view parent)
DKIM signature
missing
Download raw message
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

Re: [pages] Behaviour of Links

Ariadna Vigo <arivigodr@gmail.com>
Details
Message ID
<20210307092859.epjy2rpc6svzblxa@arch>
In-Reply-To
<fc729915-55f3-eff5-e345-c1fb0560a41b@coolguy.website> (view parent)
DKIM signature
missing
Download raw message
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

Re: [pages] Behaviour of Links

Details
Message ID
<wA1JI8dCPtAD0btSgH1HQlxPj9QxnAM0969xRIlIe_0cjL-m3AN0f1mgYSgGG4f7tkTHUXUDHscsRZYTWgfFbZnORIbqeeTYZf_1atEX5tM=@emersion.fr>
In-Reply-To
<fc729915-55f3-eff5-e345-c1fb0560a41b@coolguy.website> (view parent)
DKIM signature
missing
Download raw message
On Sunday, March 7th, 2021 at 5:30 AM, Zach! <webmaster@coolguy.website> wrote:

> https://solarpunk.cool/example

It seems to be related to the CSP. target="_blank" requires
allow-popups [1].

[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox

Re: [pages] Behaviour of Links

Details
Message ID
<C9R4Y3PG0QXH.11XHKJB27KWB3@taiga>
In-Reply-To
<wA1JI8dCPtAD0btSgH1HQlxPj9QxnAM0969xRIlIe_0cjL-m3AN0f1mgYSgGG4f7tkTHUXUDHscsRZYTWgfFbZnORIbqeeTYZf_1atEX5tM=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<38EBE53B-8CB8-4BEF-BC9D-ADE43A6C2718@benburwell.com>
In-Reply-To
<C9R4Y3PG0QXH.11XHKJB27KWB3@taiga> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<a2057ea0-a8ca-9774-47f7-9a84372b8a87@solarpunk.cool>
In-Reply-To
<20210307092859.epjy2rpc6svzblxa@arch> (view parent)
DKIM signature
missing
Download raw message
 > 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
>

Re: [pages] Behaviour of Links

Details
Message ID
<C9RF3SSLLOAD.3BU7JNV8OIXTY@taiga>
In-Reply-To
<a2057ea0-a8ca-9774-47f7-9a84372b8a87@solarpunk.cool> (view parent)
DKIM signature
missing
Download raw message
Yeah, the issue isn't pages, it's your markup. Your HTML needs to be
fixed.

Re: [pages] Behaviour of Links

Details
Message ID
<b879126b-69dc-107c-e70d-e754e6268986@solarpunk.cool>
In-Reply-To
<C9RF3SSLLOAD.3BU7JNV8OIXTY@taiga> (view parent)
DKIM signature
missing
Download raw message
> 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.

Re: [pages] Behaviour of Links

Details
Message ID
<C9RFAEN5IIIH.3AYTACK44XTSU@taiga>
In-Reply-To
<b879126b-69dc-107c-e70d-e754e6268986@solarpunk.cool> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<c169f365-be69-9b35-566b-180649303697@solarpunk.cool>
In-Reply-To
<C9RFAEN5IIIH.3AYTACK44XTSU@taiga> (view parent)
DKIM signature
missing
Download raw message
 > 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.

Re: [pages] Behaviour of Links

Details
Message ID
<C9ROCEX4W875.PMJ2G3MLA1EV@debian>
In-Reply-To
<c169f365-be69-9b35-566b-180649303697@solarpunk.cool> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<831188cc-db19-bb6f-5f12-e491c0e80cba@coolguy.website>
In-Reply-To
<wA1JI8dCPtAD0btSgH1HQlxPj9QxnAM0969xRIlIe_0cjL-m3AN0f1mgYSgGG4f7tkTHUXUDHscsRZYTWgfFbZnORIbqeeTYZf_1atEX5tM=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
Thanks all.  I've stopped using sourcehut pages.

Re: [pages] Behaviour of Links

Details
Message ID
<20210308131304.osj3v5jjfhikueiy@iyo>
In-Reply-To
<C9RF3SSLLOAD.3BU7JNV8OIXTY@taiga> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<C9RZW5QXIJ35.L3H1RXT7UG8J@taiga>
In-Reply-To
<20210308131304.osj3v5jjfhikueiy@iyo> (view parent)
DKIM signature
missing
Download raw message
But it's not in the same directory?

Re: [pages] Behaviour of Links

Details
Message ID
<C9S016J6H8PN.24D042XM2L0O2@debian>
In-Reply-To
<20210308131304.osj3v5jjfhikueiy@iyo> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<20210308132100.hunol67ieqkdgyag@iyo>
In-Reply-To
<C9RZW5QXIJ35.L3H1RXT7UG8J@taiga> (view parent)
DKIM signature
missing
Download raw message
It is though:

https://solarpunk.cool/example is actually ->

https://solarpunk.cool/example/index.html

So I would expect `<a href="two.html">`

to go to ->

https://solarpunk.cool/example/two.html

but it goes to ->

https://solarpunk.cool/two.html instead.

Re: [pages] Behaviour of Links

Details
Message ID
<C9S044EWA59Z.2LJ3KIT8JMNSJ@taiga>
In-Reply-To
<20210308132100.hunol67ieqkdgyag@iyo> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<20210308133408.whwjm4nsoa65dx7n@iyo>
In-Reply-To
<C9S044EWA59Z.2LJ3KIT8JMNSJ@taiga> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<C9S0G24IJI0X.23IVQ8O1XNIVW@debian>
In-Reply-To
<20210308133408.whwjm4nsoa65dx7n@iyo> (view parent)
DKIM signature
missing
Download raw message
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.

Re: [pages] Behaviour of Links

Details
Message ID
<20210308134323.5myba777ed24z23e@iyo>
In-Reply-To
<C9S0G24IJI0X.23IVQ8O1XNIVW@debian> (view parent)
DKIM signature
missing
Download raw message
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?

Re: [pages] Behaviour of Links

Details
Message ID
<C9S0LKPOF643.2NZY46CM5KNKZ@taiga>
In-Reply-To
<20210308134323.5myba777ed24z23e@iyo> (view parent)
DKIM signature
missing
Download raw message
I'm not opposed to adding this redirect.
Reply to thread Export thread (mbox)