diff --git a/Classes/BackendModule/SeoModule.php b/Classes/BackendModule/SeoModule.php
index 7a8b9f5..486cc7f 100644
--- a/Classes/BackendModule/SeoModule.php
+++ b/Classes/BackendModule/SeoModule.php
@@ -172,6 +172,7 @@ public function main() {
$tree->addField('keywords', 1);
$tree->addField('description', 1);
$tree->addField('tx_realurl_pathsegment', 1);
+ $tree->addField('tx_seo_priority', 1);
$tree->init('AND '.$GLOBALS['BE_USER']->getPagePermsClause(1));
@@ -262,6 +263,7 @@ protected function renderSEOTable($tree) {
$item['keywords'] = $translations[$this->langOnly]['keywords'];
$item['description'] = $translations[$this->langOnly]['description'];
$item['sys_language'] = $this->langOnly;
+ $item['tx_seo_priority'] = $translations[$this->langOnly]['tx_seo_priority'];
$itemID = $item['uid'];
}
// if no specific language is chosen, display all translations of a page
@@ -318,9 +320,11 @@ protected function renderSEOTable($tree) {
$tCells[] = '
Title Tag | ';
$tCells[] = 'Keywords | ';
$tCells[] = 'Description | ';
+ $tCells[] = 'Priority | ';
} else {
$tCells[] = 'Title Tag | ';
$tCells[] = 'Keywords | ';
+ $tCells[] = 'Priority | ';
}
$output = '' . $output;
@@ -345,6 +349,7 @@ protected function renderRowContent($item, $rowTitle = NULL) {
$row1[] = $item['tx_seo_titletag'];
$row1[] = $item['keywords'];
$row1[] = $item['description'];
+ $row1[] = ((double)$item['tx_seo_priority'] > 0) ? $item['tx_seo_priority'] : '0.5';
// before output, wrap each cell in tds
foreach ($row1 as $k => $v) {
@@ -354,8 +359,8 @@ protected function renderRowContent($item, $rowTitle = NULL) {
// display fields that can be edited
$tbl = ($item['sys_language'] > 0 ? 'pages_language_overlay' : 'pages');
$fName = 'tx_seo[' . $tbl . '][' . $item['uid'] . ']';
- $row1[] = 'Title-Tag: | | Keywords: | | ';
- $row2[] = 'Description: |
| ';
+ $row1[] = 'Title-Tag: | | Keywords: | | Priority: | | ';
+ $row2[] = 'Description: |
| ';
}
if ($this->hasAvailableLanguages) {
@@ -388,7 +393,7 @@ protected function loadLanguageOverlays($uidList) {
$where = ($this->langOnly ? ' AND sys_language_uid = ' . $this->langOnly : '');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
- 'uid, pid, sys_language_uid, title, tx_seo_titletag, keywords, description',
+ 'uid, pid, sys_language_uid, title, tx_seo_titletag, tx_seo_priority, keywords, description',
'pages_language_overlay',
'pid IN ('.$uidList .') ' . $where . BackendUtility::BEenableFields('pages_language_overlay'),
'',
@@ -402,6 +407,7 @@ protected function loadLanguageOverlays($uidList) {
'uid' => $row['uid'],
'title' => $row['title'],
'tx_seo_titletag' => $row['tx_seo_titletag'],
+ 'tx_seo_priority' => (double)$row['tx_seo_priority'] > 0 ? $row['tx_seo_priority'] : '0.5',
'keywords' => $row['keywords'],
'description' => $row['description']
);
@@ -503,7 +509,7 @@ protected function saveChanges() {
// run through every item in the table
foreach ($res as $uid => $item) {
$uid = intval($uid);
- if (empty($item['tx_seo_titletag']) && empty($item['keywords']) && empty($item['description'])) {
+ if (empty($item['tx_seo_titletag']) && empty($item['keywords']) && empty($item['description']) && empty('tx_seo_priority')) {
$emptyItems[] = $uid;
continue;
}
@@ -511,7 +517,8 @@ protected function saveChanges() {
$fields = array(
'tx_seo_titletag' => $item['tx_seo_titletag'],
'keywords' => $item['keywords'],
- 'description' => $item['description']
+ 'description' => $item['description'],
+ 'tx_seo_priority' => $item['tx_seo_priority']
);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($tbl,'uid = '.$uid,$fields);
}
@@ -523,7 +530,8 @@ protected function saveChanges() {
$fields = array(
'tx_seo_titletag' => '',
'keywords' => '',
- 'description' => ''
+ 'description' => '',
+ 'tx_seo_priority' => '0.5'
);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($tbl,'uid IN ('.$uidList.')',$fields);
}
diff --git a/Classes/Controller/SitemapController.php b/Classes/Controller/SitemapController.php
index dccc41f..0cc14e0 100644
--- a/Classes/Controller/SitemapController.php
+++ b/Classes/Controller/SitemapController.php
@@ -131,9 +131,12 @@ public function renderXMLSitemap($content, $configuration) {
// format date, see http://www.w3.org/TR/NOTE-datetime for possible formats
$lastmod = date('c', $lastmod);
+ $priority = ((double)$item['tx_seo_priority'] > 0) ? (double)$item['tx_seo_priority'] : 0.5;
$this->usedUrls[$url] = array(
'url' => $url,
'lastmod' => $lastmod
+ 'lastmod' => $lastmod,
+ 'priority' => $priority
);
}
@@ -164,7 +167,8 @@ public function renderXMLSitemap($content, $configuration) {
$content .= '
- ' . htmlspecialchars($urlData['url']) . '' . $lastModificationDate . '
+ ' . htmlspecialchars($urlData['url']) . '
+ ' . $urlData['priority'] . '' . $lastModificationDate . '
';
}
@@ -407,7 +411,7 @@ protected function resolveBaseUrl() {
*/
protected function fetchPagesFromTreeStructure($id) {
$depth = 50;
- $additionalFields = 'uid,pid,doktype,shortcut,crdate,SYS_LASTCHANGED,shortcut_mode,l18n_cfg';
+ $additionalFields = 'uid,pid,doktype,shortcut,crdate,SYS_LASTCHANGED,shortcut_mode,l18n_cfg,tx_seo_priority';
// Initializing the tree object
$treeStartingRecord = $this->getFrontendController()->sys_page->getRawRecord('pages', $id, $additionalFields);
@@ -440,6 +444,7 @@ protected function fetchPagesFromTreeStructure($id) {
$tree->addField('doktype', 1);
$tree->addField('nav_hide', 1);
$tree->addField('l18n_cfg', 1);
+ $tree->addField('tx_seo_priority', 1);
// disable recycler and everything below
$tree->init('AND doktype!=255' . $this->getFrontendController()->sys_page->enableFields('pages'));
diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php
index 50a501e..5ce7c6d 100644
--- a/Configuration/TCA/Overrides/pages.php
+++ b/Configuration/TCA/Overrides/pages.php
@@ -38,5 +38,21 @@
)
),
);
+ ),
+ 'tx_seo_priority' => array(
+ 'exclude' => 1,
+ 'label' => 'LLL:EXT:seo_basics/Resources/Private/Language/db.xml:pages.priority',
+ 'config' => array(
+ 'type' => 'input',
+ 'size' => 70,
+ 'eval' => 'trim,double2',
+ 'range' => array(
+ 'lower' => 0,
+ 'upper' => 1
+ ),
+ 'default' => 0.5
+ )
+ )
+);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $additionalColumns);
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', 'tx_seo_titletag, tx_seo_canonicaltag, tx_seo_robots', 1, 'before:keywords');
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', 'tx_seo_titletag, tx_seo_canonicaltag, tx_seo_robots, tx_seo_priority', 1, 'before:keywords');
diff --git a/Configuration/TCA/Overrides/pages_language_overlay.php b/Configuration/TCA/Overrides/pages_language_overlay.php
index 8602f53..df3e5c7 100644
--- a/Configuration/TCA/Overrides/pages_language_overlay.php
+++ b/Configuration/TCA/Overrides/pages_language_overlay.php
@@ -37,9 +37,26 @@
),
)
),
+ ),
+ 'tx_seo_priority' => array(
+ 'exclude' => 1,
+ 'label' => 'LLL:EXT:seo_basics/Resources/Private/Language/db.xml:pages.priority',
+ 'config' => array(
+ 'type' => 'input',
+ 'size' => 70,
+ 'eval' => 'trim,double2',
+ 'range' => array(
+ 'lower' => 0,
+ 'upper' => 1
+ ),
+ 'default' => 0.5
+ )
+ )
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages_language_overlay', $additionalColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages_language_overlay', 'tx_seo_titletag, tx_seo_canonicaltag, tx_seo_robots', '1', 'before:keywords');
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages_language_overlay', 'tx_seo_titletag, tx_seo_canonicaltag, tx_seo_priority', '1', 'before:keywords');
$GLOBALS['TCA']['pages_language_overlay']['interface']['showRecordFieldList'] .= ',tx_seo_titletag, tx_seo_canonicaltag, tx_seo_robots';
+$GLOBALS['TCA']['pages_language_overlay']['interface']['showRecordFieldList'] .= ',tx_seo_titletag, tx_seo_canonicaltag, tx_seo_priority';
diff --git a/Resources/Private/Language/db.xml b/Resources/Private/Language/db.xml
index 1ecc4de..d7069b5 100644
--- a/Resources/Private/Language/db.xml
+++ b/Resources/Private/Language/db.xml
@@ -16,6 +16,7 @@
+
@@ -23,6 +24,7 @@
+
diff --git a/ext_localconf.php b/ext_localconf.php
index ac9e3bc..e766df7 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -1,8 +1,8 @@