Skip to content

Commit

Permalink
[4.0] Remove Meta Keywords (part 1) (joomla#25258)
Browse files Browse the repository at this point in the history
* [4.0] Remove Meta Keywords (part 1)

Meta Keywords as a meta tag has pretty much been irrelevant for **10 years**

This PR does the following

1. Removes Site Meta Keywords from global config
2. Removes Menu item Meta Keywords
3. Removes per language Meta Keywords
4. Renames the item field Meta Keywords to Keywords
 - We use this as a field with mod_related_items and com_banners

Part 2 of removing meta keywords will
1. Move the Keyword field to a more appropriate place
2. Check that all the keyword fields are used with mod_related_items and com_banners

### Testing
Check that Meta Keyword field is removed from global config and menu items
Check that renamed Keyword field does not produce a meta key in the frontend

* .

* Update language/en-GB/mod_related_items.sys.ini

Co-Authored-By: Quy <quy@fluxbb.org>

* Update Content.php

* Update Content.php

* Update com_banners.ini

Co-authored-by: Quy <quy@fluxbb.org>
  • Loading branch information
brianteeman and Quy committed Feb 9, 2020
1 parent ac793b4 commit 490d28d
Show file tree
Hide file tree
Showing 44 changed files with 17 additions and 305 deletions.
9 changes: 0 additions & 9 deletions administrator/components/com_config/forms/application.xml
Expand Up @@ -628,15 +628,6 @@
charcounter="true"
/>

<field
name="MetaKeys"
type="textarea"
label="COM_CONFIG_FIELD_METAKEYS_LABEL"
filter="string"
cols="60"
rows="3"
/>

<field
name="robots"
type="list"
Expand Down
Expand Up @@ -86,7 +86,6 @@ public function getJson()
'access' => null,
'list_limit' => null,
'MetaDesc' => null,
'MetaKeys' => null,
'MetaRights' => null,
'sef' => null,
'sitename_pagetitles' => null,
Expand Down
34 changes: 0 additions & 34 deletions administrator/components/com_contact/Table/ContactTable.php
Expand Up @@ -199,40 +199,6 @@ public function check()
$this->hits = 0;
}

/*
* Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string.
* Only process if not empty.
*/
if (!empty($this->metakey))
{
// Array of characters to remove.
$badCharacters = array("\n", "\r", "\"", '<', '>');

// Remove bad characters.
$afterClean = StringHelper::str_ireplace($badCharacters, '', $this->metakey);

// Create array using commas as delimiter.
$keys = explode(',', $afterClean);
$cleanKeys = array();

foreach ($keys as $key)
{
// Ignore blank keywords.
if (trim($key))
{
$cleanKeys[] = trim($key);
}
}

// Put array back together delimited by ", "
$this->metakey = implode(', ', $cleanKeys);
}
else
{
$this->metakey = '';
}

// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
Expand Down
12 changes: 2 additions & 10 deletions administrator/components/com_languages/forms/language.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="lang_id"
<field
name="lang_id"
type="text"
label="JGLOBAL_FIELD_ID_LABEL"
class="readonly"
Expand Down Expand Up @@ -89,14 +89,6 @@
/>
</fieldset>
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS">
<field
name="metakey"
type="textarea"
label="JFIELD_META_KEYWORDS_LABEL"
rows="3"
cols="30"
/>

<field
name="metadesc"
type="textarea"
Expand Down
8 changes: 0 additions & 8 deletions administrator/components/com_menus/forms/item_component.xml
Expand Up @@ -96,14 +96,6 @@
cols="40"
/>

<field
name="menu-meta_keywords"
type="textarea"
label="JFIELD_META_KEYWORDS_LABEL"
rows="3"
cols="40"
/>

<field
name="robots"
type="list"
Expand Down
27 changes: 0 additions & 27 deletions administrator/components/com_newsfeeds/Table/NewsfeedTable.php
Expand Up @@ -100,33 +100,6 @@ public function check()
return false;
}

// Clean up keywords -- eliminate extra spaces between phrases
// and cr (\r) and lf (\n) characters from string if not empty
if (!empty($this->metakey))
{
// Array of characters to remove
$bad_characters = array("\n", "\r", "\"", '<', '>');

// Remove bad characters
$after_clean = StringHelper::str_ireplace($bad_characters, '', $this->metakey);

// Create array using commas as delimiter
$keys = explode(',', $after_clean);
$clean_keys = array();

foreach ($keys as $key)
{
if (trim($key))
{
// Ignore blank keywords
$clean_keys[] = trim($key);
}
}

// Put array back together delimited by ", "
$this->metakey = implode(', ', $clean_keys);
}

// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
Expand Down
28 changes: 0 additions & 28 deletions administrator/components/com_tags/Table/TagTable.php
Expand Up @@ -133,34 +133,6 @@ public function check()
throw new \UnexpectedValueException(sprintf('End publish date is before start publish date.'));
}

// Clean up keywords -- eliminate extra spaces between phrases
// and cr (\r) and lf (\n) characters from string
if (!empty($this->metakey))
{
// Only process if not empty
// Define array of characters to remove
$bad_characters = array("\n", "\r", "\"", '<', '>');

// Remove bad characters
$after_clean = StringHelper::str_ireplace($bad_characters, '', $this->metakey);

// Create array using commas as delimiter
$keys = explode(',', $after_clean);
$clean_keys = array();

foreach ($keys as $key)
{
if (trim($key))
{
// Ignore blank keywords
$clean_keys[] = trim($key);
}
}

// Put array back together delimited by ", "
$this->metakey = implode(', ', $clean_keys);
}

// Clean up description -- eliminate quotes and <> brackets
if (!empty($this->metadesc))
{
Expand Down
9 changes: 4 additions & 5 deletions administrator/language/en-GB/com_banners.ini
Expand Up @@ -73,8 +73,8 @@ COM_BANNERS_FIELD_BASENAME_LABEL="File Name"
COM_BANNERS_FIELD_CLICKS_LABEL="Total Clicks"
COM_BANNERS_FIELD_CLICKURL_LABEL="Click URL"
COM_BANNERS_FIELD_CLIENT_LABEL="Client"
COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_DESC="When matching Meta keywords, only search for Meta keywords with this prefix (improves performance)."
COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_LABEL="Meta Keyword Prefix"
COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_DESC="When matching Keywords, only search for Keywords with this prefix (improves performance)."
COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_LABEL="Keyword Prefix"
COM_BANNERS_FIELD_CLIENTOWNPREFIX_LABEL="Use Own Prefix"
COM_BANNERS_FIELD_COMPRESSED_LABEL="Compressed"
COM_BANNERS_FIELD_CONTACT_LABEL="Contact Name"
Expand All @@ -88,8 +88,8 @@ COM_BANNERS_FIELD_HEIGHT_LABEL="Height"
COM_BANNERS_FIELD_IMAGE_LABEL="Image"
COM_BANNERS_FIELD_IMPMADE_LABEL="Total Impressions"
COM_BANNERS_FIELD_IMPTOTAL_LABEL="Max. Impressions"
COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC="When matching Meta keywords, only search for Meta keywords with this prefix (improves performance)."
COM_BANNERS_FIELD_METAKEYWORDPREFIX_LABEL="Meta Keyword Prefix"
COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC="When matching Keywords, only search for Keywords with this prefix (improves performance)."
COM_BANNERS_FIELD_METAKEYWORDPREFIX_LABEL="Keyword Prefix"
COM_BANNERS_FIELD_NAME_LABEL="Name"
COM_BANNERS_FIELD_PUBLISH_DOWN_LABEL="Finish Publishing"
COM_BANNERS_FIELD_PUBLISH_UP_LABEL="Start Publishing"
Expand Down Expand Up @@ -135,7 +135,6 @@ COM_BANNERS_HEADING_COUNT_DESC="Count descending"
COM_BANNERS_HEADING_IMPRESSIONS="Impressions"
COM_BANNERS_HEADING_IMPRESSIONS_ASC="Impressions ascending"
COM_BANNERS_HEADING_IMPRESSIONS_DESC="Impressions descending"
COM_BANNERS_HEADING_METAKEYWORDS="Meta Keywords"
COM_BANNERS_HEADING_NAME="Name"
COM_BANNERS_HEADING_PURCHASETYPE="Purchase Type"
COM_BANNERS_HEADING_PURCHASETYPE_ASC="Purchase Type ascending"
Expand Down
1 change: 0 additions & 1 deletion administrator/language/en-GB/com_config.ini
Expand Up @@ -111,7 +111,6 @@ COM_CONFIG_FIELD_REDIS_PERSISTENT_LABEL="Persistent Redis"
COM_CONFIG_FIELD_REDIS_PORT_LABEL="Redis Server Port"
COM_CONFIG_FIELD_METAAUTHOR_LABEL="Author Meta Tag"
COM_CONFIG_FIELD_METADESC_LABEL="Site Meta Description"
COM_CONFIG_FIELD_METAKEYS_LABEL="Site Meta Keywords"
COM_CONFIG_FIELD_METAVERSION_LABEL="Joomla Version"
COM_CONFIG_FIELD_OFFLINE_IMAGE_LABEL="Offline Image"
COM_CONFIG_FIELD_OFFLINE_MESSAGE_LABEL="Custom Message"
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/joomla.ini
Expand Up @@ -236,7 +236,7 @@ JFIELD_META_DESCRIPTION_COUNTER="{remaining} characters remaining of {maxlength}
JFIELD_META_DESCRIPTION_DESC="An optional paragraph to be used as the description of the page in the HTML output. This will generally display in the results of search engines."
JFIELD_META_DESCRIPTION_LABEL="Meta Description"
JFIELD_META_KEYWORDS_DESC="An optional comma-separated list of keywords and/or phrases to be used in the HTML output."
JFIELD_META_KEYWORDS_LABEL="Meta Keywords"
JFIELD_META_KEYWORDS_LABEL="Keywords"
JFIELD_META_RIGHTS_DESC="Describe what rights others have to use this content."
JFIELD_META_RIGHTS_LABEL="Content Rights"
JFIELD_METADATA_AUTHOR_DESC="The author of this content."
Expand Down
9 changes: 0 additions & 9 deletions components/com_config/forms/config.xml
Expand Up @@ -14,15 +14,6 @@
charcounter="true"
/>

<field
name="MetaKeys"
type="textarea"
label="COM_CONFIG_FIELD_METAKEYS_LABEL"
filter="string"
cols="60"
rows="3"
/>

<field
name="MetaRights"
type="textarea"
Expand Down
9 changes: 0 additions & 9 deletions components/com_contact/View/Contact/HtmlView.php
Expand Up @@ -549,15 +549,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->item->metakey)
{
$this->document->setMetaData('keywords', $this->item->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
5 changes: 0 additions & 5 deletions components/com_contact/View/Featured/HtmlView.php
Expand Up @@ -187,11 +187,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
5 changes: 0 additions & 5 deletions components/com_content/View/Archive/HtmlView.php
Expand Up @@ -267,11 +267,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
9 changes: 0 additions & 9 deletions components/com_content/View/Article/HtmlView.php
Expand Up @@ -346,15 +346,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->item->metakey)
{
$this->document->setMetaData('keywords', $this->item->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
9 changes: 0 additions & 9 deletions components/com_content/View/Category/HtmlView.php
Expand Up @@ -199,15 +199,6 @@ public function display($tpl = null)
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->category->metakey)
{
$this->document->setMetaData('keywords', $this->category->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
5 changes: 0 additions & 5 deletions components/com_content/View/Featured/HtmlView.php
Expand Up @@ -254,11 +254,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
5 changes: 0 additions & 5 deletions components/com_content/View/Form/HtmlView.php
Expand Up @@ -221,11 +221,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
10 changes: 0 additions & 10 deletions components/com_finder/View/Search/HtmlView.php
Expand Up @@ -321,16 +321,6 @@ protected function prepareDocument($query)
$this->document->setDescription($this->params->get('menu-meta_description'));
}

// Configure the document meta-keywords.
if (!empty($query->highlight))
{
$this->document->setMetaData('keywords', implode(', ', $query->highlight));
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
Expand Down
9 changes: 0 additions & 9 deletions components/com_newsfeeds/View/Newsfeed/HtmlView.php
Expand Up @@ -331,15 +331,6 @@ protected function _prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->item->metakey)
{
$this->document->setMetaData('keywords', $this->item->metakey);
}
elseif ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetaData('robots', $this->params->get('robots'));
Expand Down
5 changes: 0 additions & 5 deletions components/com_privacy/View/Confirm/HtmlView.php
Expand Up @@ -137,11 +137,6 @@ protected function prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
Expand Down
5 changes: 0 additions & 5 deletions components/com_privacy/View/Remind/HtmlView.php
Expand Up @@ -137,11 +137,6 @@ protected function prepareDocument()
$this->document->setDescription($this->params->get('menu-meta_description'));
}

if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}

if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
Expand Down

0 comments on commit 490d28d

Please sign in to comment.