List for cgit developers and users
 help / color / mirror / Atom feed
* trailing slash page canonicalization
@ 2016-05-12 19:44 Jason
  2016-05-12 20:14 ` wub
  2016-05-15 11:17 ` normalperson
  0 siblings, 2 replies; 4+ messages in thread
From: Jason @ 2016-05-12 19:44 UTC (permalink / raw)


Hi folks,

When Christian implemented /about/image.jpg handling, it brought up
the issue of /about vs /about/ and I wound up adding this commit [1]
to canonicalize that url so that rendered content would always wind up
referencing the correct relative path.

We have another potential issue, however. git.zx2c4.com/cgit and
git.zx2c4.com/cgit/ have the same content, yet different URLs. This
might be looked upon unfavorably by search engines. One rectification
is to add a meta tag. Another, and one I'd like to consider here, is
to always add the trailing slash to pages with the same 301 trick as
[1].

I'm interested in hearing some thought and considerations (and even
diffs if someone beats me to it?) before I merge this though.

Regards,
Jason

[1] https://git.zx2c4.com/cgit/commit/?id=d7034806a4b1279f62d606501f831dcad31798e6


^ permalink raw reply	[flat|nested] 4+ messages in thread

* trailing slash page canonicalization
  2016-05-12 19:44 trailing slash page canonicalization Jason
@ 2016-05-12 20:14 ` wub
  2016-05-12 20:56   ` Jason
  2016-05-15 11:17 ` normalperson
  1 sibling, 1 reply; 4+ messages in thread
From: wub @ 2016-05-12 20:14 UTC (permalink / raw)


To be honest, it feels like handling canonical URIs is what the
webserver should handle, not the CGI application unless I'm missing
something here.

A poor example but GitHub uses meta canonical URI on the repository
index, but not for issues.

Unless it's really broken and not just about SEO optimization, I would
leave the heavy lifting to the webserver.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* trailing slash page canonicalization
  2016-05-12 20:14 ` wub
@ 2016-05-12 20:56   ` Jason
  0 siblings, 0 replies; 4+ messages in thread
From: Jason @ 2016-05-12 20:56 UTC (permalink / raw)


On Thu, May 12, 2016 at 10:14 PM, Juuso Lapinlampi <wub at partyvan.eu> wrote:

> To be honest, it feels like handling canonical URIs is what the
> webserver should handle, not the CGI application unless I'm missing
> something here.
>

That's not how CGI works though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20160512/9ecdc88e/attachment.html>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* trailing slash page canonicalization
  2016-05-12 19:44 trailing slash page canonicalization Jason
  2016-05-12 20:14 ` wub
@ 2016-05-15 11:17 ` normalperson
  1 sibling, 0 replies; 4+ messages in thread
From: normalperson @ 2016-05-15 11:17 UTC (permalink / raw)


"Jason A. Donenfeld" <Jason at zx2c4.com> wrote:
> We have another potential issue, however. git.zx2c4.com/cgit and
> git.zx2c4.com/cgit/ have the same content, yet different URLs. This
> might be looked upon unfavorably by search engines. One rectification
> is to add a meta tag. Another, and one I'd like to consider here, is
> to always add the trailing slash to pages with the same 301 trick as
> [1].

I think canonicalizing is a good idea to improve cacheability, too.

For HTML, I favor trailing slash for consideration with people
who want to mirror to a static site (e.g. with "wget -r -np").
That results in "$DOCROOT/foo/index.html" on the FS; making it
easy for common configurations of static HTTP servers to serve
for "/foo/" using the "$DOCROOT/foo/index.html" file.

Without the trailing slash, "wget -r -np" would create a
"$DOCROOT/foo" file, and it's not easy to serve the right
Content-Type with a static file server that way.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-15 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-12 19:44 trailing slash page canonicalization Jason
2016-05-12 20:14 ` wub
2016-05-12 20:56   ` Jason
2016-05-15 11:17 ` normalperson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).