[9.1.10] date de publication des articles et suppression des barres

This commit is contained in:
fredtempez 2019-06-13 14:01:43 +02:00
parent 3e867ad22d
commit 9a66fe707d
2 changed files with 14 additions and 6 deletions

View File

@ -3,7 +3,8 @@
## Version 9.1.10 ## Version 9.1.10
- Améliorations : - Améliorations :
- Page sitemap et sitemap.xml : les articles de blog avec le statut brouillon sont masqués. - Page sitemap et sitemap.xml : les articles de blog avec le statut brouillon sont masqués.
- Réseau social : Github - Réseau social : Github.
- Sitemap : ajout de la date de publication des articles.
## Version 9.1.09 ## Version 9.1.09
- Améliorations : - Améliorations :

View File

@ -642,6 +642,8 @@ class common {
require_once "core/vendor/sitemap/SitemapGenerator.php"; require_once "core/vendor/sitemap/SitemapGenerator.php";
$timezone = $this->getData(['config','timezone']);
$sitemap = new \Icamys\SitemapGenerator\SitemapGenerator(helper::baseurl()); $sitemap = new \Icamys\SitemapGenerator\SitemapGenerator(helper::baseurl());
// will create also compressed (gzipped) sitemap // will create also compressed (gzipped) sitemap
@ -660,7 +662,9 @@ class common {
$sitemap->sitemapIndexFileName = "sitemap-index.xml"; $sitemap->sitemapIndexFileName = "sitemap-index.xml";
foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) { foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) {
// Exclure les barres et les pages non publiques et les pages masquées // Exclure les barres et les pages non publiques et les pages masquées
if ($this->getData(['page',$parentPageId,'group']) !== 0 || $this->getData(['page', $parentPageId, 'disable']) === true) { if ($this->getData(['page',$parentPageId,'group']) !== 0 ||
$this->getData(['page', $parentPageId, 'disable']) === true ||
$this->getData(['page', $parentPageId, 'block']) === 'bar' ) {
continue; continue;
} }
// Sous-pages // Sous-pages
@ -675,7 +679,8 @@ class common {
if ($this->getData(['page', $childKey, 'moduleId']) === 'blog') { if ($this->getData(['page', $childKey, 'moduleId']) === 'blog') {
foreach($this->getData(['module',$childKey]) as $articleId => $article) { foreach($this->getData(['module',$childKey]) as $articleId => $article) {
if($this->getData(['module',$childKey,$articleId,'state']) === true) { if($this->getData(['module',$childKey,$articleId,'state']) === true) {
$sitemap->addUrl( $childKey . '/' . $articleId ) ; $date = $this->getData(['module',$childKey,$articleId,'publishedOn']);
$sitemap->addUrl( $childKey . '/' . $articleId , new DateTime("@{$date}"),new DateTimeZone($timezone)) ;
} }
} }
} }
@ -683,12 +688,14 @@ class common {
// Articles du blog // Articles du blog
if ($this->getData(['page', $parentPageId, 'moduleId']) === 'blog') { if ($this->getData(['page', $parentPageId, 'moduleId']) === 'blog') {
foreach($this->getData(['module',$parentPageId]) as $articleId => $article) { foreach($this->getData(['module',$parentPageId]) as $articleId => $article) {
if($this->getData(['module',$parentPageId,$articleId,'state']) === true) { if($this->getData(['module',$parentPageId,$articleId,'state']) === true) {
$sitemap->addUrl( $parentPageId . '/' . $articleId ) ; $date = $this->getData(['module',$parentPageId,$articleId,'publishedOn']);
$sitemap->addUrl( $parentPageId . '/' . $articleId , new DateTime("@{$date}",new DateTimeZone($timezone)));
} }
} }
} }
} }
// generating internally a sitemap // generating internally a sitemap
$sitemap->createSitemap(); $sitemap->createSitemap();