Skip to content

Commit

Permalink
STU-54
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Oct 14, 2023
1 parent 6a1b6c3 commit c363ec6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 3.3.4 - 2023-10-14
### Fixed
- Fixed an an error where deleted sections were still shown in the sitemap settings ([#82](https://github.com/studioespresso/craft-seo-fields/issues/82))


## 3.3.3 - 2023-09-18
### Fixed
- Fixed an error when using a custom meta template ([#81](https://github.com/studioespresso/craft-seo-fields/issues/81))
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "studioespresso/craft-seo-fields",
"description": "Fields for your SEO & OG meta data",
"type": "craft-plugin",
"version": "3.3.3",
"version": "3.3.4",
"keywords": [
"craft",
"cms",
Expand Down
16 changes: 12 additions & 4 deletions src/controllers/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace studioespresso\seofields\controllers;

use Craft;
use craft\db\Query;
use craft\helpers\Db;
use craft\records\Section_SiteSettings;
use craft\web\Controller;
use studioespresso\seofields\models\SeoDefaultsModel;
Expand All @@ -23,11 +25,17 @@ public function actionSettings($siteHandle = null)
{
$site = Craft::$app->getSites()->getSiteByHandle($siteHandle);
Craft::$app->getSites()->getSiteByHandle($site);
$sectionsForSite = Section_SiteSettings::findAll(['siteId' => $site->id]);
$query = new Query();
$query->select('sectionId as id')
->from('{{%sections_sites}}')
->leftJoin('{{%sections}}', 'sections.id = sections_sites.sectionId')
->where(Db::parseParam('siteId', $site->id))
->andWhere(['sections.dateDeleted' => null]);
$sections = [];
foreach ($sectionsForSite as $s) {
$sections[] = Craft::$app->getSections()->getSectionById($s->sectionId);
foreach ($query->all() as $s) {
$sections[] = Craft::$app->getSections()->getSectionById($s['id']);
}

$data = SeoFields::$plugin->defaultsService->getDataBySiteHandle($siteHandle);
return $this->renderTemplate('seo-fields/_sitemap', [
'data' => $data,
Expand Down Expand Up @@ -63,7 +71,7 @@ public function actionRender()
if (!$data) {
throw new NotFoundHttpException(Craft::t('app', 'Page not found'), 404);
}

$xml = SeoFields::$plugin->sitemapSerivce->getSitemapIndex(array_filter($data));

$headers = Craft::$app->response->headers;
Expand Down

0 comments on commit c363ec6

Please sign in to comment.