Fix #2407 support $CATEGORY in document title SEO

This commit is contained in:
Kijin Sung 2024-10-07 21:08:27 +09:00
parent 12af0905f8
commit fc86ae24de
3 changed files with 4 additions and 2 deletions

View file

@ -268,7 +268,7 @@ $lang->about_seo_main_title = 'This format will be used for the title of the mai
$lang->seo_subpage_title = 'Subpage Title';
$lang->about_seo_subpage_title = 'This format will be used for the title of lists and other major components of your website.<br>In additions to the variables above, you can use <b>$PAGE</b>.';
$lang->seo_document_title = 'Document Page Title';
$lang->about_seo_document_title = 'This format will be used for the title of individual documents.<br>In additions to the variables above, you can use <b>$DOCUMENT_TITLE</b>.';
$lang->about_seo_document_title = 'This format will be used for the title of individual documents.<br>In additions to the variables above, you can use <b>$CATEGORY</b> and <b>$DOCUMENT_TITLE</b>.';
$lang->site_meta_keywords = 'SEO Keywords';
$lang->about_site_meta_keywords = 'These keywords will be used on pages that do not have their own keywords.';
$lang->site_meta_description = 'SEO Description';

View file

@ -264,7 +264,7 @@ $lang->about_seo_main_title = '사이트 메인 화면에 표시되는 제목
$lang->seo_subpage_title = '서브페이지 제목';
$lang->about_seo_subpage_title = '문서 목록, 페이지 등 주요 메뉴를 방문하면 표시되는 제목 형태입니다. 위의 변수들과 함께 <b>$PAGE</b> (페이지)도 사용할 수 있습니다.';
$lang->seo_document_title = '개별 문서 페이지 제목';
$lang->about_seo_document_title = '게시물을 읽는 화면에서 표시되는 제목 형태입니다. 위에 변수들과 함께 <b>$DOCUMENT_TITLE</b> (문서 제목)도 사용할 수 있습니다.';
$lang->about_seo_document_title = '게시물을 읽는 화면에서 표시되는 제목 형태입니다. 위에 변수들과 함께 <b>$CATEGORY</b> (카테고리명), <b>$DOCUMENT_TITLE</b> (문서 제목)도 사용할 수 있습니다.';
$lang->site_meta_keywords = 'SEO 키워드';
$lang->about_site_meta_keywords = '별도의 키워드를 지정하지 않은 페이지에서는 이 키워드 목록이 표시됩니다.';
$lang->site_meta_description = 'SEO 설명';

View file

@ -339,11 +339,13 @@ class BoardView extends Board
Context::setCanonicalURL($oDocument->getPermanentUrl());
$seo_title = config('seo.document_title') ?: '$SITE_TITLE - $DOCUMENT_TITLE';
$seo_title = Context::replaceUserLang($seo_title);
$category_list = Context::get('category_list');
Context::setBrowserTitle($seo_title, array(
'site_title' => Context::getSiteTitle(),
'site_subtitle' => Context::getSiteSubtitle(),
'subpage_title' => $this->module_info->browser_title,
'document_title' => $oDocument->getTitleText(),
'category' => ($oDocument->get('category_srl') && isset($category_list[$oDocument->get('category_srl')])) ? $category_list[$oDocument->get('category_srl')]->title : '',
'page' => Context::get('page') ?: 1,
));