Use global keywords and description if a module does not have its own SEO info

This commit is contained in:
Kijin Sung 2016-05-08 23:23:27 +09:00
parent 98f0b0cd1c
commit faf4b1ea54
8 changed files with 95 additions and 0 deletions

View file

@ -295,6 +295,25 @@ class ModuleHandler extends Handler
Context::setBrowserTitle(Context::getSiteTitle());
Context::addBrowserTitle($module_info->browser_title);
}
$module_config = $oModuleModel->getModuleConfig('module');
if ($module_info->meta_keywords)
{
Context::addMetaTag('keywords', escape($module_info->meta_keywords));
}
elseif($module_config->meta_keywords)
{
Context::addMetaTag('keywords', escape($module_config->meta_keywords));
}
if ($module_info->meta_description)
{
Context::addMetaTag('description', escape($module_info->meta_description));
}
elseif($module_config->meta_description)
{
Context::addMetaTag('description', escape($module_config->meta_description));
}
$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';

View file

@ -771,6 +771,24 @@ class adminAdminController extends admin
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigDebug'));
}
/**
* Update SEO configuration.
*/
function procAdminUpdateSEO()
{
$vars = Context::getRequestVars();
$args = new stdClass;
$args->meta_keywords = $vars->site_meta_keywords ? implode(', ', array_map('trim', explode(',', $vars->site_meta_keywords))) : '';
$args->meta_description = trim(utf8_normalize_spaces($vars->site_meta_description));
$oModuleController = getController('module');
$oModuleController->updateModuleConfig('module', $args);
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSEO'));
}
/**
* Update sitelock configuration.
*/

View file

@ -564,6 +564,21 @@ class adminAdminView extends admin
$this->setTemplateFile('config_debug');
}
/**
* Display Debug Settings page
* @return void
*/
function dispAdminConfigSEO()
{
// Site title and HTML footer
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('module');
Context::set('site_meta_keywords', escape($config->meta_keywords));
Context::set('site_meta_description', escape($config->meta_description));
$this->setTemplateFile('config_seo');
}
/**
* Display Sitelock Settings page
* @return void

View file

@ -8,6 +8,7 @@
<action name="dispAdminConfigSecurity" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigAdvanced" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigDebug" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigSEO" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigSitelock" type="view" menu_name="adminConfigurationGeneral" />
<action name="dispAdminConfigFtp" type="view" menu_name="adminConfigurationFtp" menu_index="true" />
<action name="dispAdminSetup" type="view" menu_name="adminMenuSetup" menu_index="true" />
@ -26,6 +27,7 @@
<action name="procAdminUpdateSecurity" type="controller" />
<action name="procAdminUpdateAdvanced" type="controller" />
<action name="procAdminUpdateDebug" type="controller" />
<action name="procAdminUpdateSEO" type="controller" />
<action name="procAdminUpdateSitelock" type="controller" />
<action name="procAdminUpdateFTPInfo" type="controller" />
<action name="procAdminRemoveFTPInfo" type="controller" />

View file

@ -5,6 +5,7 @@ $lang->subtitle_primary = 'General Settings';
$lang->subtitle_security = 'Security Settings';
$lang->subtitle_advanced = 'Advanced Settings';
$lang->subtitle_debug = 'Debug Settings';
$lang->subtitle_seo = 'SEO Settings';
$lang->subtitle_etc = 'Other Settings';
$lang->current_state = 'Current state';
$lang->latest_documents = 'Latest Documents';
@ -142,6 +143,10 @@ $lang->debug_log_filename = 'Log filename';
$lang->about_debug_log_filename = 'YYYYMMDD in the filename will be replaced with the current date.<br>It is recommended to split the log file by date to prevent it from getting too large.';
$lang->msg_debug_log_filename_not_writable = 'Rhymix cannot write log files in the specified path.';
$lang->debug_allowed_ip = 'Allowed IP addresses';
$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';
$lang->about_site_meta_description = 'This description will be used on pages that do not have their own description.';
$lang->autoinstall = 'EasyInstall';
$lang->last_week = 'Last Week';
$lang->this_week = 'This Week';

View file

@ -5,6 +5,7 @@ $lang->subtitle_primary = '기본 설정';
$lang->subtitle_security = '보안 설정';
$lang->subtitle_advanced = '고급 설정';
$lang->subtitle_debug = '디버그 설정';
$lang->subtitle_seo = 'SEO 설정';
$lang->subtitle_etc = '기타';
$lang->current_state = '현황';
$lang->latest_documents = '최근 글';
@ -145,6 +146,10 @@ $lang->debug_log_filename = '디버그 정보 기록 파일';
$lang->about_debug_log_filename = '파일명에 YYYYMMDD가 포함된 경우 날짜별로 파일을 분리하여 기록합니다.<br>파일을 분리하지 않으면 용량이 매우 커질 수 있으니 주의하십시오.';
$lang->msg_debug_log_filename_not_writable = '지정한 경로에 로그 파일을 작성할 수 없습니다.';
$lang->debug_allowed_ip = '디버그 허용 IP';
$lang->site_meta_keywords = 'SEO 키워드';
$lang->about_site_meta_keywords = '별도의 키워드를 지정하지 않은 페이지에서는 이 키워드 목록이 표시됩니다.';
$lang->site_meta_description = 'SEO 설명';
$lang->about_site_meta_description = '별도의 설명을 지정하지 않은 페이지에서는 이 설명이 표시됩니다.';
$lang->autoinstall = '쉬운 설치';
$lang->last_week = '지난주';
$lang->this_week = '이번주';

View file

@ -8,5 +8,6 @@
<li class="x_active"|cond="$act == 'dispAdminConfigSecurity'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigSecurity')}">{$lang->subtitle_security}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigAdvanced'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigAdvanced')}">{$lang->subtitle_advanced}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigDebug'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigDebug')}">{$lang->subtitle_debug}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigSEO'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigSEO')}">{$lang->subtitle_seo}</a></li>
<li class="x_active"|cond="$act == 'dispAdminConfigSitelock'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock')}">{$lang->subtitle_sitelock}</a></li>
</ul>

View file

@ -0,0 +1,30 @@
<include target="config_header.html" />
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/admin/tpl/config_seo/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<section class="section">
<form action="./" method="post" class="x_form-horizontal">
<input type="hidden" name="module" value="admin" />
<input type="hidden" name="act" value="procAdminUpdateSEO" />
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_seo/1" />
<div class="x_control-group">
<label class="x_control-label" for="site_meta_keywords">{$lang->site_meta_keywords}</label>
<div class="x_controls">
<input type="text" name="site_meta_keywords" id="site_meta_keywords" value="{$site_meta_keywords}" style="min-width: 80%" class="lang_code" />
<p class="x_help-block">{$lang->about_site_meta_keywords}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="site_meta_description">{$lang->site_meta_description}</label>
<div class="x_controls">
<input type="text" name="site_meta_description" id="site_meta_description" value="{$site_meta_description}" style="min-width: 80%" class="lang_code" />
<p class="x_help-block">{$lang->about_site_meta_description}</p>
</div>
</div>
<div class="x_clearfix btnArea">
<div class="x_pull-right">
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
</div>
</div>
</form>
</section>