Disable translation of page title

Hi there. I have a multi lang Kirby installation and I was wondering how I can disable the translation of page titles to assure that all pages have the exact same titles across all languages…?

Does anybody know? Thank you!

I guess there’s no such a feature.

But you can lock the page title with options like that:

title: Blog
options:
    changeTitle: false

Thank you!

But maybe I just do it with the page.changeTitle:after hook then and just override the other languages titles. Seems to work and does the job.

Here is my result for future reference:

'page.changeTitle:after' => function ($newPage, $oldPage) {

	$currentLang = kirby()->languageCode();
	$newTitle = $newPage->content( $currentLang )->title()->value();

	foreach( kirby()->languages()->codes() as $lang ){
		if( $currentLang == $lang ){
			continue;
		}
		$newPage->update([
			'title' => $newTitle
		], $lang );
	}

}
1 Like

Hello,

where do you actually put this code to work?

Thanks!

You can place hooks within your site/config/config.php or in your own plugin. More on hooks: Hooks | Kirby CMS

1 Like