Skip to content

Commit 19fd693

Browse files
committed
fix: #139
1 parent 648dd9c commit 19fd693

File tree

5 files changed

+40
-37
lines changed

5 files changed

+40
-37
lines changed

classes/Meta.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public function __construct(Page $page, ?Language $lang = null)
4949
*/
5050
public static function normalizeLocale(string $locale, string $separator = '-'): string
5151
{
52-
// Remove encoding suffix if present (e.g., '.UTF-8')
53-
$locale = Str::before($locale, '.');
52+
// encoding suffix if present (e.g., '.UTF-8')
53+
$locale = Str::contains($locale, '.') ? Str::before($locale, '.') : $locale;
5454

55-
// Replace both underscores and hyphens with the desired separator
55+
// target both underscores and hyphens
5656
$locale = Str::replace($locale, '_', $separator);
5757
$locale = Str::replace($locale, '-', $separator);
5858

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "tobimori/kirby-seo",
33
"description": "The ultimate Kirby SEO toolkit",
44
"type": "kirby-plugin",
5-
"version": "2.0.0-alpha.1",
5+
"version": "2.0.0-alpha.2",
66
"license": "proprietary",
77
"homepage": "https://github.com/tobimori/kirby-seo#readme",
88
"authors": [

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/site-methods.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
use Kirby\Http\Url;
44
use Kirby\Toolkit\Str;
5+
use tobimori\Seo\Meta;
56
use tobimori\Seo\SchemaSingleton;
67
use tobimori\Seo\Seo;
78

89
return [
910
'schema' => fn ($type) => SchemaSingleton::getInstance($type),
1011
'schemas' => fn () => SchemaSingleton::getInstances(),
11-
'lang' => fn () => Str::replace(Seo::option('default.lang')($this->homePage()), '_', '-'),
12+
'lang' => fn () => Meta::normalizeLocale(Seo::option('default.locale', args: [$this->homePage()]), '-'),
1213
'canonicalFor' => function (string $url, bool $useRootUrl = false) {
1314
// Determine the base URL
1415
$base = Seo::option('canonical.base', Seo::option('canonicalBase'));

vendor/composer/installed.php

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
<?php return array(
2-
'root' => array(
3-
'name' => 'tobimori/kirby-seo',
4-
'pretty_version' => '2.0.0-alpha.1',
5-
'version' => '2.0.0.0-alpha1',
6-
'reference' => null,
7-
'type' => 'kirby-plugin',
8-
'install_path' => __DIR__ . '/../../',
9-
'aliases' => array(),
10-
'dev' => false,
11-
),
12-
'versions' => array(
13-
'getkirby/composer-installer' => array(
14-
'pretty_version' => '1.2.1',
15-
'version' => '1.2.1.0',
16-
'reference' => 'c98ece30bfba45be7ce457e1102d1b169d922f3d',
17-
'type' => 'composer-plugin',
18-
'install_path' => __DIR__ . '/../getkirby/composer-installer',
19-
'aliases' => array(),
20-
'dev_requirement' => false,
21-
),
22-
'tobimori/kirby-seo' => array(
23-
'pretty_version' => '2.0.0-alpha.1',
24-
'version' => '2.0.0.0-alpha1',
25-
'reference' => null,
26-
'type' => 'kirby-plugin',
27-
'install_path' => __DIR__ . '/../../',
28-
'aliases' => array(),
29-
'dev_requirement' => false,
30-
),
31-
),
1+
<?php
2+
3+
return array(
4+
'root' => array(
5+
'name' => 'tobimori/kirby-seo',
6+
'pretty_version' => '2.0.0-alpha.2',
7+
'version' => '2.0.0.0-alpha2',
8+
'reference' => null,
9+
'type' => 'kirby-plugin',
10+
'install_path' => __DIR__ . '/../../',
11+
'aliases' => array(),
12+
'dev' => false,
13+
),
14+
'versions' => array(
15+
'getkirby/composer-installer' => array(
16+
'pretty_version' => '1.2.1',
17+
'version' => '1.2.1.0',
18+
'reference' => 'c98ece30bfba45be7ce457e1102d1b169d922f3d',
19+
'type' => 'composer-plugin',
20+
'install_path' => __DIR__ . '/../getkirby/composer-installer',
21+
'aliases' => array(),
22+
'dev_requirement' => false,
23+
),
24+
'tobimori/kirby-seo' => array(
25+
'pretty_version' => '2.0.0-alpha.2',
26+
'version' => '2.0.0.0-alpha2',
27+
'reference' => null,
28+
'type' => 'kirby-plugin',
29+
'install_path' => __DIR__ . '/../../',
30+
'aliases' => array(),
31+
'dev_requirement' => false,
32+
),
33+
),
3234
);

0 commit comments

Comments
 (0)