Browse Source

Index: do not index drafts

imwald
Nuša Pukšič 4 days ago
parent
commit
85f053f445
  1. 13
      src/Util/IndexableArticleChecker.php

13
src/Util/IndexableArticleChecker.php

@ -4,11 +4,22 @@ namespace App\Util;
use App\Entity\Article; use App\Entity\Article;
use App\Enum\IndexStatusEnum; use App\Enum\IndexStatusEnum;
use App\Enum\KindsEnum;
class IndexableArticleChecker class IndexableArticleChecker
{ {
public static function isIndexable(Article $article): bool public static function isIndexable(Article $article): bool
{ {
return $article->getIndexStatus() !== IndexStatusEnum::DO_NOT_INDEX; // Don't index drafts - they're private working copies
if ($article->getKind() === KindsEnum::LONGFORM_DRAFT->value) {
return false;
}
// Don't index articles explicitly marked as do not index
if ($article->getIndexStatus() === IndexStatusEnum::DO_NOT_INDEX) {
return false;
}
return true;
} }
} }

Loading…
Cancel
Save