Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify canonical and alternate URLs #1033

Closed
pljones opened this issue Sep 4, 2024 · 11 comments
Closed

Identify canonical and alternate URLs #1033

pljones opened this issue Sep 4, 2024 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@pljones
Copy link
Contributor

pljones commented Sep 4, 2024

Originally posted by @pljones in #1026 (comment)

I don't think it's right...

https://github.com/jamulussoftware/jamuluswebsite/actions/runs/10696055730
http://jamuluswebsite.drealm.info/wiki/Installation-for-Linux

<!DOCTYPE html>
<!--[if IE 9]>
<html class="ie9">
<![endif]-->
<html lang="en">
<head>
<title>Installation for Linux – Jamulus Website</title>
<meta charset="utf-8">
<link rel="canonical" hreflang="en" href="/wiki/Installation-for-Linux">
<link rel="alternate" hreflang="sv-SE" href="/sv-SE/wiki/Installation-for-Linux">
...

http://jamuluswebsite.drealm.info/sv-SE/wiki/Installation-for-Linux

<!DOCTYPE html>
<!--[if IE 9]>
<html class="ie9">
<![endif]-->
<html lang="sv-SE">
<head>
<title>Installation för Linux – Jamulus websida</title>
<meta charset="utf-8">
<link rel="canonical" hreflang="en" href="/sv-SE/wiki/Installation-for-Linux">
<link rel="alternate" hreflang="sv-SE" href="/sv-SE/wiki/Installation-for-Linux">
...
  1. If ie9, we get two html tags, which cannot be right. Does IE 9 still exist? Is the XML comment actually parsed?
  2. The http://jamuluswebsite.drealm.info/sv-SE/wiki/Installation-for-Linux page says canonical is en, okay but gives the wrong href to get there.

I should have spotted that earlier, sorry!

@pljones pljones added the bug Something isn't working label Sep 4, 2024
@pljones pljones added this to Tracking Sep 4, 2024
@github-project-automation github-project-automation bot moved this to Triage in Tracking Sep 4, 2024
@pljones pljones added this to the Release 3.11.0 milestone Sep 4, 2024
@pljones pljones moved this from Triage to Backlog in Tracking Sep 4, 2024
@pljones
Copy link
Contributor Author

pljones commented Sep 4, 2024

<!-- Canonical and Alternate Links -->
{% comment %}
English URLs don't have a lang subdirectory since it's the default language.
See https://github.com/untra/polyglot
{% endcomment %}
        <link rel="canonical" hreflang="en"        href="{{ site.url }}{{ site.baseurl }}{{ page.url }}">
{% for lng in site.languages | sort %}
  {% if lng != "en" %}
        <link rel="alternate" hreflang="{{ lng }}" href="{{ site.url }}{{ site.baseurl }}/{{ lng }}{{ page.url }}">
  {% endif %}
{% endfor %}
canonical href alternate href
source "{{ site.url }}{{ site.baseurl }}{{ page.url }}" "{{ site.url }}{{ site.baseurl }}/{{ lng }}{{ page.url }}"
English "/wiki/Installation-for-Linux" "/sv-SE/wiki/Installation-for-Linux"
Swedish "/sv-SE/wiki/Installation-for-Linux" "/sv-SE/wiki/Installation-for-Linux"

From the rendered output, it looks like {{ site.url }}{{ site.baseurl }} is empty, {{ page.url }} is the language-specific page URL (i.e. /wiki/Installation-for-Linux or /sv-SE/wiki/Installation-for-Linux) and the additional / followed by {{ lng }} prefix is getting removed during creation of the HTML ("helpfully").

@gilgongo
Copy link
Member

gilgongo commented Sep 4, 2024

  1. The http://jamuluswebsite.drealm.info/sv-SE/wiki/Installation-for-Linux page says canonical is en, okay but gives the wrong href to get there.

I'm not seeing that when I run the site locally. I get this, which I think is correct?

<link rel="canonical" hreflang="en" href="http://0.0.0.0:4000/wiki/Installation-for-Linux">
<link rel="alternate" hreflang="sv-SE" href="http://0.0.0.0:4000/sv-SE/wiki/Installation-for-Linux">

Not sure I follow what you mean with the comment about IE9.

Do you mean this is some issue with GH Pages rendering vs doing it locally?

@pljones
Copy link
Contributor Author

pljones commented Sep 4, 2024

I'm not seeing that when I run the site locally. I get this, which I think is correct?

Which language was your current language?

@gilgongo
Copy link
Member

gilgongo commented Sep 4, 2024

I'm not seeing that when I run the site locally. I get this, which I think is correct?

Which language was your current language?

sv-SE - also works OK if I switch back and forth between languages (did a git pull and switched to next-release before looking BTW)

@pljones
Copy link
Contributor Author

pljones commented Sep 4, 2024

I'm using the Website.zip file unpacked.
https://github.com/jamulussoftware/jamuluswebsite/actions/runs/10696055730
if I got the right file...

-rwxrwxr--+ 1 peter www-data 9117903 Sep  4 16:11 Website.zip

@gilgongo
Copy link
Member

gilgongo commented Sep 4, 2024

That's strange - wonder why they're different? I suppose it makes sense that it doesn't use FQ URLs, but that doesn't account for the the canonical being the wrong one.

@pljones
Copy link
Contributor Author

pljones commented Sep 4, 2024

Yep, just downloaded it again and looked directly in the file _site/sv-SE/wiki/Installation-for-Linux.html (with line breaks added)

<!DOCTYPE html>
<!--[if IE 9]>
<html class="ie9">
<![endif]-->
<html lang="sv-SE">
<head>
<title>Installation för Linux – Jamulus websida</title>
<meta charset="utf-8">
<link rel="canonical" hreflang="en" href="/sv-SE/wiki/Installation-for-Linux">
<link rel="alternate" hreflang="sv-SE" href="/sv-SE/wiki/Installation-for-Linux">
...

@pljones
Copy link
Contributor Author

pljones commented Sep 4, 2024

That's strange - wonder why they're different? I suppose it makes sense that it doesn't use FQ URLs, but that doesn't account for the the canonical being the wrong one.

How are you running the site? Are you generating it and then handing the output to Apache or are you running it with po4a or something and looking at the generated page source?

I'm wondering if Github is using a subtly different way of generating the output...

@gilgongo
Copy link
Member

gilgongo commented Sep 4, 2024

That's strange - wonder why they're different? I suppose it makes sense that it doesn't use FQ URLs, but that doesn't account for the the canonical being the wrong one.

How are you running the site?

On an Ubuntu VM, I've got ruby with various gems to run Jekyll, and with all the po4a stuff. I git clone/pull, switch to next-release, run the po4a script (which BTW I see throws a warning about an unexpected closing div), then run jekyll serve --host=0.0.0.0. Jekyll has a built-in web server I guess. Basically according to this.

It's so I can test changes without having to make PR first.

@ignotus666
Copy link
Contributor

which BTW I see throws a warning about an unexpected closing div

That will go away when #1025 gets merged. It's because po4a is a little too strict about tags.

@gilgongo
Copy link
Member

Closing with #1039

@github-project-automation github-project-automation bot moved this from Backlog to Done in Tracking Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants