Search…

X3 Photo Gallery Support Forums

Search…
 
metallissimus
Experienced
Topic Author
Posts: 332
Joined: 17 Oct 2019, 06:54

Set language in <head>

13 Feb 2020, 07:06

I ran a SEO tool for my website and they suggested I declare the language of the site. I tried injecting the code via Custom -> <head> but it wasn't recognized, I guess I used some wrong syntax.  Here's what I tried so far:
Code
<html lang="de">
and
Code
<lang="de">
I assume they are both wrong because you probably can't use <html> inside another html-tag and <lang> just isn't a tag.
But how would I do that correctly?
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14026
Joined: 30 Sep 2006, 03:37

Re: Set language in <head>

14 Feb 2020, 05:32

Unfortunately, there is no way to edit the <html> tag in X3 (except for clumsy workarounds). I really haven't considered any requests like this before, but might have to consider it for a future X3 release. Personally, I don't think this attribute has any effect on SEO, as Google should easily be able to figure out what language your website is. This is also emphasized in the below link:
https://www.woorank.com/en/edu/seo-guid ... eclaration

The exception could be if you have multi-lingual content, for example some pages in English and some in a different language.
 
metallissimus
Experienced
Topic Author
Posts: 332
Joined: 17 Oct 2019, 06:54

Re: Set language in <head>

17 Feb 2020, 05:31

Alright. I already assumed it doesn't have much impact, so it's really not that important for me. I just thought if there's an easy way, why not implement it – won't do any harm either.
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography
 
metallissimus
Experienced
Topic Author
Posts: 332
Joined: 17 Oct 2019, 06:54

Re: Set language in <head>

14 Apr 2023, 13:49

I stumbled upon this again in a different context: hyphenation. I want to enable auto hyphenation and somehow the CSS didn't work. I found this as a possible explanation:
Hyphenation rules are language-specific. In HTML, the language is determined by the lang attribute, and browsers will hyphenate only if this attribute is present and the appropriate hyphenation dictionary is available.
https://developer.mozilla.org/en-US/doc ... SS/hyphens

It's not a huge deal, but something like this is rather ugly on the eyes:
Bildschirmfoto 2023-04-14 um 19.48.09.png
Bildschirmfoto 2023-04-14 um 19.48.09.png (75.82 KiB) Viewed 13249 times
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14026
Joined: 30 Sep 2006, 03:37

Re: Set language in <head>

14 Apr 2023, 22:11

Did you try to set lang="de" in Settings > Custom > Custom <head>? You can also set language directly on a parent element in the content, for example:
Code
<div lang="de">All your stuff here</div>
Not sure how well this works though, especially in other languages than English. According to the browser-compatibility chart, this CSS not supported in all languages across all browsers. It seems only Firefox supports German perhaps.
https://developer.mozilla.org/en-US/doc ... patibility

Also, I can't quite see in your screenshot where it's supposed to automatically break a word with hyphen. Surely you can't break "Umständen" into "Um-ständen"? And "Businessporträts" could only break into "Business-porträts" if "Business" would fit on the previous line, but to me it doesn't look like it does. I can't honestly see where auto-hypehnation would work as it can only break certain words at certain points.
 
metallissimus
Experienced
Topic Author
Posts: 332
Joined: 17 Oct 2019, 06:54

Re: Set language in <head>

15 Apr 2023, 05:54

mjau-mjau wrote: It seems only Firefox supports German perhaps.
https://developer.mozilla.org/en-US/doc ... patibility
I wasn't aware of that... looks like I will have to deal with the worst cases manually then...
Surely you can't break "Umständen" into "Um-ständen"?
Yes, you can. Actually you can break in into "Um-stän-den" according to German grammar.
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14026
Joined: 30 Sep 2006, 03:37

Re: Set language in <head>

16 Apr 2023, 00:05

With narrow text sections like in your case, perhaps it could be an idea to use "justify" text-align instead, so that each line (except the last) will attempt to fill the entire width.
https://css-tricks.com/almanac/properti ... t-justify/
Image
metallissimus wrote:
mjau-mjau wrote: It seems only Firefox supports German perhaps.
https://developer.mozilla.org/en-US/doc ... patibility
I wasn't aware of that... looks like I will have to deal with the worst cases manually then...
Did you try it in Firefox or Safari? The main problem is that German doesn't yet seem to be supported in Chrome.

I wasn't aware of the "hyphens" CSS feature. It's interesting, but it's definitely required to be locale-aware, because the OS/browser needs to know what words (in each specific language) are allowed to break at what point.
 
metallissimus
Experienced
Topic Author
Posts: 332
Joined: 17 Oct 2019, 06:54

Re: Set language in <head>

17 Apr 2023, 07:53

mjau-mjau wrote: With narrow text sections like in your case, perhaps it could be an idea to use "justify" text-align instead, so that each line (except the last) will attempt to fill the entire width.
That'a good idea! Of course there are still some ugly lines sometimes... I will have to think about the "lesser evil": occasial huge gaps at the end of lines, occasional huge gaps between words, or all the time I would have to put into manual hyphenation.

mjau-mjau wrote: The main problem is that German doesn't yet seem to be supported in Chrome.
Unfortunately Chrome is used by most of my visitors – by far.
www.danielbollinger.de – corporate photography
hochzeiten.danielbollinger.de – wedding photography