Changed meta fields, no longer custom properties

This commit is contained in:
Don Chambers 2012-10-17 10:51:42 -05:00
parent 2dbc5e47b4
commit 36fd48b5bc
4 changed files with 84 additions and 44 deletions

View file

@ -1,3 +1,6 @@
3.98 Changed custom <title>, meta description, and meta keywords to be regular fields,
not custom properties.
3.97: Changed breadcrumb navigation so it is an independent option. Templates that use custom
static page templates (plugin_staticpage.tpl, plugin_staticpage_aboutpage.tpl,
plugin_staticpage_related.tpl) must be modified to include the condition

View file

@ -66,42 +66,21 @@
</div>
<div id="el1">
<div class="sp_sect">
<label class="sp_label" title="Custom Title Element">{$CONST.STATICPAGES_CUSTOM_META_TITLE}</label>
<input class="input_textbox" type="text" name="serendipity[plugin][custom][title_element]" value="{$form_values.custom.title_element|@default:''}">
</div>
<div class="sp_sect">
<label class="sp_label" title="{staticpage_input item="title_element" what="desc"|escape:js}">{staticpage_input item="title_element" what="name"|escape:js}</label><br />
{staticpage_input item="title_element"}
</div>
<div class="sp_sect">
<label class="sp_label" title="Custom META Description">{$CONST.STATICPAGES_CUSTOM_META_DESC}</label>
<input class="input_textbox" type="text" name="serendipity[plugin][custom][meta_description]" value="{$form_values.custom.meta_description|@default:''}">
</div>
<div class="sp_sect">
<label class="sp_label" title="{staticpage_input item="meta_description" what="desc"|escape:js}">{staticpage_input item="meta_description" what="name"|escape:js}</label><br />
{staticpage_input item="meta_description"}
</div>
<div class="sp_sect">
<label class="sp_label" title="Custom META Keywords">{$CONST.STATICPAGES_CUSTOM_META_KEYS}</label>
<input class="input_textbox" type="text" name="serendipity[plugin][custom][meta_keywords]" value="{$form_values.custom.meta_keywords|@default:''}">
</div>
<div id="helper_note"><span title="{literal}
Replace this part in the head of you templates index.tpl file:&#013;&#013;
<title>{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}</title>&#013;
&#013;with&#013;&#013;
{if $staticpage_custom.title_element}&#013;
&#009;<title>{$staticpage_custom.title_element|escape:htmlall}</title>&#013;
{else}&#013;
&#009;<title>{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}</title>&#013;
{/if}&#013;
{if $startpage}&#013;
&#009;<meta name='description' content='{* YOUR DESCRIPTION FOR THE STARTPAGE *}'>&#013;
&#009;<meta name='keywords' content='{* YOUR KEYWORDS FOR THE STARTPAGE *}'>&#013;
&#009;<meta name='author' content='{* YOUR AUTHOR DESC FOR THE STARTPAGE *}'>&#013;
{/if}&#013;
{if $staticpage_custom.meta_description}&#013;
&#009;<meta name='description' content='{$staticpage_custom.meta_description|escape:htmlall}'>&#013;
{/if}&#013;
{if $staticpage_custom.meta_keywords}&#013;
&#009;<meta name='keywords' content='{$staticpage_custom.meta_keywords|escape:htmlall}'>&#013;
{/if}&#013;{/literal}">{$CONST.STATICPAGE_SHOWMETA_DEFAULT_METANOTE},<br>or view <a href="http://board.s9y.org/viewtopic.php?f=4&p=10432412#p10432412" target="_blank" style="background-color: lightblue;">this forum post</a>.</span>
</div>
</div>
<div class="sp_sect">
<label class="sp_label" title="{staticpage_input item="meta_keywords" what="desc"|escape:js}">{staticpage_input item="meta_keywords" what="name"|escape:js}</label><br />
{staticpage_input item="meta_keywords"}
</div>
</div>
<script type="text/javascript" language="JavaScript">document.getElementById("el1").style.display = "none";</script>
{/if}
</fieldset>

View file

@ -66,9 +66,7 @@
@define('STATICPAGE_SHOWONNAVI_DESC', 'Show this page on the list of static pages in your sidebar.');
@define('STATICPAGE_SHOWNAVI_DEFAULT', 'Include navigation');
@define('STATICPAGE_SHOWMETA_DEFAULT_DESC', ' - Please view additional note in the staticpage form!');
@define('STATICPAGE_SHOWMETA_DEFAULT', 'Include HTML meta input fields');
@define('STATICPAGE_SHOWMETA_DEFAULT_METANOTE', 'If enabled, please hover me to see on how to change your templates index.tpl file.');
@define('STATICPAGE_DEFAULT_DESC', 'Default setting for new pages.');
@define('STATICPAGE_SHOWONNAVI_DEFAULT', 'Show page on sidebar-navigation');
@define('STATICPAGE_SHOWMARKUP_DEFAULT', 'Show markup');
@ -124,9 +122,12 @@
@define('STATICPAGES_CUSTOM_STRUCTURE_SHOW', 'Show Structural field options');
@define('STATICPAGES_CUSTOM_META_SHOW', 'Show optional META field entries');
@define('STATICPAGES_CUSTOM_META_TITLE', 'HTML META title element (optional)');
@define('STATICPAGES_CUSTOM_META_TITLE', 'HTML title element (optional)');
@define('STATICPAGES_CUSTOM_META_TITLE_BLAH_BLAH', 'Will be emitted as <title>Your title here</title>');
@define('STATICPAGES_CUSTOM_META_DESC', 'HTML META Description (optional)');
@define('STATICPAGES_CUSTOM_META_DESC_BLAH_BLAH', 'Will be emitted as <meta name="description" content="Your html meta description here">');
@define('STATICPAGES_CUSTOM_META_KEYS', 'HTML META Keywords (optional)');
@define('STATICPAGES_CUSTOM_META_KEYS_BLAH_BLAH', 'Will be emitted as <meta name="keywords" content="Your html meta keywords here">');
//
// serendipity_plugin_staticpage.php

View file

@ -49,7 +49,10 @@ class serendipity_event_staticpage extends serendipity_event
'showonnavi',
'showmeta',
'timestamp',
'show_breadcrumb'
'show_breadcrumb',
'title_element',
'meta_description',
'meta_keywords'
);
var $config_types = array(
@ -82,13 +85,14 @@ class serendipity_event_staticpage extends serendipity_event
'frontend_fetchentries' => true,
'backend_media_rename' => true,
'frontend_fetchentries' => true,
'frontend_rss' => true
'frontend_rss' => true,
'frontend_header' => true
));
$propbag->add('page_configuration', $this->config);
$propbag->add('type_configuration', $this->config_types);
$propbag->add('author', 'Marco Rinck, Garvin Hicking, David Rolston, Falk Doering, Stephan Manske, Pascal Uhlmann, Ian, Don Chambers');
$propbag->add('version', '3.97');
$propbag->add('version', '3.98');
$propbag->add('requirements', array(
'serendipity' => '1.3',
'smarty' => '2.6.7',
@ -142,8 +146,8 @@ class serendipity_event_staticpage extends serendipity_event
case 'showmeta':
$propbag->add('type', 'boolean');
$propbag->add('name', STATICPAGE_SHOWMETA_DEFAULT);
$propbag->add('description', STATICPAGE_DEFAULT_DESC . STATICPAGE_SHOWMETA_DEFAULT_DESC);
$propbag->add('default', 'false');
$propbag->add('description', STATICPAGE_DEFAULT_DESC);
$propbag->add('default', '1');
break;
case 'show_breadcrumb':
@ -209,6 +213,27 @@ class serendipity_event_staticpage extends serendipity_event
$propbag->add('description', STATICPAGE_FILENAME_DESC);
$propbag->add('default', 'plugin_staticpage.tpl');
break;
case 'title_element':
$propbag->add('type', 'string');
$propbag->add('name', STATICPAGES_CUSTOM_META_TITLE);
$propbag->add('description', STATICPAGES_CUSTOM_META_TITLE_BLAH_BLAH);
$propbag->add('default', '');
break;
case 'meta_description':
$propbag->add('type', 'string');
$propbag->add('name', STATICPAGES_CUSTOM_META_DESC);
$propbag->add('description', STATICPAGES_CUSTOM_META_DESC_BLAH_BLAH);
$propbag->add('default', '');
break;
case 'meta_keywords':
$propbag->add('type', 'string');
$propbag->add('name', STATICPAGES_CUSTOM_META_KEYS);
$propbag->add('description', STATICPAGES_CUSTOM_META_KEYS_BLAH_BLAH);
$propbag->add('default', '');
break;
case 'content':
$propbag->add('type', 'html');
@ -930,7 +955,16 @@ class serendipity_event_staticpage extends serendipity_event
$q = "ALTER TABLE {$serendipity['dbPrefix']}staticpages ADD COLUMN show_breadcrumb int(4) default '1'";
serendipity_db_schema_import($q);
}
$this->set_config('db_built', 20);
case 20:
if (!$fresh) {
$q = "ALTER TABLE {$serendipity['dbPrefix']}staticpages ADD COLUMN title_element varchar(255) not null default ''";
serendipity_db_schema_import($q);
$q = "ALTER TABLE {$serendipity['dbPrefix']}staticpages ADD COLUMN meta_description varchar(255) not null default ''";
serendipity_db_schema_import($q);
$q = "ALTER TABLE {$serendipity['dbPrefix']}staticpages ADD COLUMN meta_keywords varchar(255) not null default ''";
serendipity_db_schema_import($q);
}
$this->set_config('db_built', 21);
break;
}
}
@ -1232,7 +1266,10 @@ class serendipity_event_staticpage extends serendipity_event
$pagevar . 'lastchange' => $this->get_static('last_modified'),
$pagevar . 'shownavi' => $this->get_static('shownavi'),
$pagevar . 'show_breadcrumb' => $this->get_static('show_breadcrumb'),
$pagevar . 'custom' => $this->get_static('custom')
$pagevar . 'custom' => $this->get_static('custom'),
$pagevar . 'title_element' => $this->get_static('title_element'),
$pagevar . 'meta_description' => $this->get_static('meta_description'),
$pagevar . 'meta_keywords' => $this->get_static('meta_keywords')
// same thing as above
// $pagevar . 'related_category_entries' => $related_category_entries
)
@ -2870,11 +2907,31 @@ foreach($select AS $select_value => $select_desc) {
}
if ($this->selected()) {
$te = $this->get_static('title_element');
if (!empty($te)) {
$serendipity['head_title'] = htmlspecialchars($te);
$serendipity['head_subtitle'] ='';
} else {
$serendipity['head_title'] = $this->get_static('headline');
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
}
}
break;
case 'frontend_header':
$md = htmlspecialchars($this->get_static('meta_description'));
$mk = htmlspecialchars($this->get_static('meta_keywords'));
if (!empty($md))
{
echo ' <meta name="description" content="' . $md . '" />' . "\n";
}
if (!empty($mk))
{
echo ' <meta name="keywords" content="' . $mk . '" />' . "\n";
}
break;
case 'frontend_fetchentries':
if ($serendipity['GET']['action'] == 'search') {
serendipity_smarty_fetch('ENTRIES', 'entries.tpl', true);