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

Unify "Godot Engine" in html titles #922

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

JohnVeness
Copy link
Contributor

@JohnVeness JohnVeness commented Aug 31, 2024

Most pages have HTML title tags (which show in browser title bars, tabs, bookmarks etc,) with a suffix of "- Godot Engine", e.g.:

  • Features - Godot Engine
  • Contact - Godot Engine
  • License - Godot Engine
  • Download for Linux - Godot Engine

But some didn't conform, e.g.:

  • Godot Engine - Blog
  • Godot Engine - Community

or even just:

  • Press Kit
  • User Groups

This PR is an attempt to unify the page titles, including removing duplication of "Godot" when appropriate.

However, I'm not sure this is necessarily the best solution. Maybe the site name should be defined somewhere centrally and automatically added as a suffix, rather than added to pages manually as I have done.

Also, my solution doesn't fix pages like:

There may be other pages I've missed.

Also also, I'm not sure if the blog category pages should be like:

  • "Blog - News - Godot Engine" as currently in the PR, or
  • "News - Blog - Godot Engine", or even just
  • "News - Godot Engine"

Hence marking this as a draft for now. Suggestions welcome!

@coppolaemilio
Copy link
Member

I like the idea of unifying the titles! instead of repeating them in every page this could be added on the template itself. So that when a title is provided, it gets added + ' – Godot Engine', Generally speaking, I think it is fine having or not having the "Godot Engine" on the title on every page, specially because as soon as you get a little happy with tabs, you can only partially see the first word, and the favicon is already a good indicator to know in which page you currently are.

@JohnVeness
Copy link
Contributor Author

I like the idea of unifying the titles! instead of repeating them in every page this could be added on the template itself. So that when a title is provided, it gets added + ' – Godot Engine'.

Thanks! If you could point me at the correct file to edit, I'll give it a go.

@coppolaemilio
Copy link
Member

Line 20 in the default.html contains the logic for the title tag in the :

<title>{{ page.title | default: "Godot Engine" }}</title>

What you see there is the template checking if page.title exists to display it, or show the Godot Engine by default.
I imagine with something like:

{% if page.title %}
	<title>{{ page.title }} – Godot Engine</title>
{% else %}
	<title>Godot Engine</title>
{% endif %}

Could do the trick. But then you can be a bit more smart and also check if page.title already contains Godot Engine, or also add another variable to tell the template to not append the – Godot Engine part.

Hope that helps!

@JohnVeness
Copy link
Contributor Author

Many thanks! I think I'm going to have to bail for now, though, as I'm having trouble getting the site to build locally so can't really test :(

Still, if you wanted to merge my manual changes anyway, at least that would be better, even if not perfect.

@JohnVeness JohnVeness marked this pull request as ready for review September 4, 2024 20:20
@coppolaemilio
Copy link
Member

@JohnVeness I might make a new PR doing this from the template side. But what issues were you running into? I've updated the readme to cover how to run this project in linux, but what OS are you using?

@JohnVeness
Copy link
Contributor Author

Ah, the new instructions seem to work fine, thanks. I expect the problem was that I wasn't using 3.1.2 - I was using 3.3, as supplied in the openSUSE Tumbleweed repos.

I'll have a fiddle with the template idea.

@JohnVeness JohnVeness reopened this Sep 11, 2024
@JohnVeness JohnVeness marked this pull request as ready for review September 11, 2024 14:25
@JohnVeness
Copy link
Contributor Author

JohnVeness commented Sep 11, 2024

Please can you have a look now?

I have removed all the manual page title changes for now, and done everything in the template. This looks rather clumsy at the moment, because it first removes a suffix " - Godot Engine" if the page currently has it, then adds it on again! This is to avoid having to search and replace the rest of the site for now (I can do this in a separate PR or add it to this one, then simplify this).

I haven't done the same removal of a prefix "Godot Engine - " suffix yet. There are only a couple of pages that incorrectly use that, meaning you would see "Godot Engine - Community - Godot Engine" with this PR at the moment. Again, I can manually clean those in a separate PR or in this one.

I have added a "notitlesuffix" property that can be added to a page so as to not modify the title at all. I have added this property to the home page only, so that it still appears as "Godot Engine - Free and open source 2D and 3D game engine", as I assume that has been specifically chosen.

Copy link
Member

@coppolaemilio coppolaemilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated a couple pages you missed. It should be good to go!

@coppolaemilio coppolaemilio merged commit 93ef0ce into godotengine:master Sep 11, 2024
1 check passed
@coppolaemilio
Copy link
Member

Thanks!

@JohnVeness
Copy link
Contributor Author

Thanks for your help and encouragement! I quite enjoyed learning a little about jekyll.

I was wondering if similar should be done to the og:title and twitter:title meta tags? I don't particular wish to share a link onto that hellhole to see how they look though...

@JohnVeness JohnVeness deleted the titles branch September 11, 2024 18:40
@coppolaemilio
Copy link
Member

maybe it is not necessary? still, you can get previews in some other platforms like discord or mastodon. If it works there, it is pretty much the same as in the rest of pages. Except linkedin... no one really knows what linkedin will do with your link 💩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants