mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
#1961 sitemap.xml categories make cities optional
This commit is contained in:
parent
aacd3fa83a
commit
62f575f0d2
@ -7,4 +7,11 @@ return [
|
||||
"default_value" => 5000,
|
||||
]
|
||||
],
|
||||
"include_cities_sitemap" => [
|
||||
"type" => "anomaly.field_type.boolean",
|
||||
"config" => [
|
||||
"default_value" => true,
|
||||
"mode" => "checkbox",
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
@ -4,4 +4,7 @@ return [
|
||||
'sitemap_dividing_number' => [
|
||||
'name' => 'Sitemap Dividing Number',
|
||||
],
|
||||
'include_cities_sitemap' => [
|
||||
'name' => 'Include Cities in Sitemap',
|
||||
],
|
||||
];
|
||||
|
||||
@ -23,9 +23,14 @@ class SitemapController extends PublicController
|
||||
public function index()
|
||||
{
|
||||
$categoriesCount = $this->categoryRepository->count();
|
||||
$citiesCount = $this->cityRepository->count();
|
||||
|
||||
$pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount;
|
||||
if (setting_value('visiosoft.module.cats::include_cities_sitemap')) {
|
||||
$citiesCount = $this->cityRepository->count();
|
||||
$pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount;
|
||||
} else {
|
||||
$pagesCount = $categoriesCount;
|
||||
}
|
||||
|
||||
$pagesCount = ceil($pagesCount / setting_value('visiosoft.module.cats::sitemap_dividing_number'));
|
||||
|
||||
return response()->view('visiosoft.module.cats::sitemap.index', [
|
||||
@ -39,8 +44,8 @@ class SitemapController extends PublicController
|
||||
$page = request()->page ?: 1;
|
||||
$skip = $page - 1;
|
||||
|
||||
$citiesCount = $this->cityRepository->count();
|
||||
if ($citiesCount) {
|
||||
if (setting_value('visiosoft.module.cats::include_cities_sitemap')
|
||||
&& $citiesCount = $this->cityRepository->count()) {
|
||||
$categoriesCount = $this->categoryRepository->count();
|
||||
|
||||
$takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user