Browse Source

Ajout des tags dans feeds

Sangfroid 4 weeks ago
parent
commit
d8bd5e65b8
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/Service/FeedService.php

+ 8 - 0
src/Service/FeedService.php

@@ -53,6 +53,14 @@ class FeedService
                 ->setDateModified($item->getDateCreated())
                 ->addAuthor(['name' => (string) $article->getAuthor()])
             ;
+            $tags = $article->getTags();
+            foreach($tags as $tag) {
+                $item->addCategory([
+                    'term' => (string) $tag->getName(),
+                    'scheme' => $this->router->generate('app_search', ['tag' => $tag->getName()], RouterInterface::ABSOLUTE_URL)
+                ]);
+            }
+
             # Fix pour supprimer le allowfullscreen récupéré par l'extension embed pour youtube
             $content = $this->markdownParser->convertToHtml($article->getContent());
             $content = str_replace('allowfullscreen', 'allowfullscreen="true"', $content);