Fix guide content language and language switcher context
- Change getGuidePage() to use currentLanguage instead of detectLanguage() - Add lang_switch_url template variable for proper context-aware switching - Language switcher now stays on guide page when switching languages - Guide content now displays in correct language based on URL parameter
This commit is contained in:
@@ -626,7 +626,7 @@ class CodePressCMS {
|
||||
* @return array Guide page data
|
||||
*/
|
||||
private function getGuidePage() {
|
||||
$lang = $this->detectLanguage();
|
||||
$lang = $this->currentLanguage;
|
||||
$guideFile = __DIR__ . '/../../../guide/' . $lang . '.md';
|
||||
|
||||
if (!file_exists($guideFile)) {
|
||||
@@ -796,6 +796,8 @@ class CodePressCMS {
|
||||
'homepage_title' => $homepageTitle,
|
||||
'is_homepage' => (!isset($_GET['page']) || $_GET['page'] === $this->config['default_page']),
|
||||
'home_active_class' => (!isset($_GET['page']) || $_GET['page'] === $this->config['default_page']) ? 'active' : '',
|
||||
'is_guide_page' => isset($_GET['guide']),
|
||||
'lang_switch_url' => isset($_GET['guide']) ? '&guide' : '&page=' . $this->config['default_page'],
|
||||
'author_name' => $this->config['author']['name'] ?? 'CodePress Developer',
|
||||
'author_website' => $this->config['author']['website'] ?? '#',
|
||||
'author_git' => $this->config['author']['git'] ?? '#',
|
||||
|
||||
Reference in New Issue
Block a user