-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New option to include every thread page into the Sitemap
- Loading branch information
Showing
11 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace SEOUtils\XF\Sitemap; | ||
|
||
class Thread extends XFCP_Thread | ||
{ | ||
public function getEntry($record) | ||
{ | ||
/** @var \XF\Entity\Thread $record */ | ||
|
||
$result = parent::getEntry($record); | ||
|
||
if (is_array($result) || !$this->app->options()->SEOUtilsIncludeAllPages) { | ||
return $result; | ||
} | ||
|
||
$perPage = max(1, intval($this->app->options()->discussionsPerPage)); | ||
$total = max(0, intval($record->reply_count + 1)); | ||
$totalPages = ceil($total / $perPage); | ||
|
||
if ($totalPages <= 1) { | ||
return $result; | ||
} | ||
|
||
$resultWithPages = [$result]; | ||
|
||
// We create an \XF\Sitemap\Entry for each page of a thread. | ||
for($page = 2; $page <= $totalPages; $page++) | ||
{ | ||
$url = $this->app->router('public')->buildLink('canonical:threads', $record, ['page' => $page]); | ||
$resultWithPages[] = \XF\Sitemap\Entry::create($url, [ | ||
'lastmod' => $record->last_post_date | ||
]); | ||
} | ||
|
||
return $resultWithPages; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
_output/class_extensions/XF-Sitemap-Thread_SEOUtils-XF-Sitemap-Thread.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"from_class": "XF\\Sitemap\\Thread", | ||
"to_class": "SEOUtils\\XF\\Sitemap\\Thread", | ||
"execute_order": 10, | ||
"active": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"edit_format": "onoff", | ||
"edit_format_params": "", | ||
"data_type": "boolean", | ||
"sub_options": [], | ||
"validation_class": "", | ||
"validation_method": "", | ||
"default_value": "0", | ||
"relations": { | ||
"SEOUtils": 2 | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Enter a Thread ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Include all pages in the Sitemap |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
By default XenForo only includes the first page of each thread in the sitemap. | ||
|
||
<p>When you turn on this option, the sitemap will include all the pages of each thread.</p> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"legacy_addon_id": "", | ||
"title": "SEO Utilities", | ||
"description": "", | ||
"description": "Various options to improve the SEO of your forum", | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"dev": "", | ||
"dev_url": "", | ||
"dev": "JulianD", | ||
"dev_url": "https://xenforo.com/community/members/juliand.33/", | ||
"faq_url": "", | ||
"support_url": "", | ||
"extra_urls": [], | ||
"require": [], | ||
"icon": "" | ||
"icon": "fa-chart-line" | ||
} |