Skip to content

Commit 0864ded

Browse files
Merge pull request #116 from ContentsViewer/pre
noindex タグ追加
2 parents 0ad0858 + 11d2795 commit 0864ded

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Module/ContentsDatabaseManager.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ public static function RegistMetadata($content){
6363
ContentsDatabase::UnregistTag($content->Path());
6464
ContentsDatabase::UnregistLatest($content->Path());
6565

66+
ContentsDatabase::NotifyContentsChange($content->UpdatedAtTimestamp());
67+
68+
if(in_array('noindex', $content->Tags(), true)){
69+
return;
70+
}
71+
6672
$shouldAddLatest = true;
6773
foreach($content->Tags() as $tag){
6874
ContentsDatabase::RegistTag($content->Path(), $tag);
@@ -75,7 +81,6 @@ public static function RegistMetadata($content){
7581
if($shouldAddLatest){
7682
ContentsDatabase::RegistLatest($content->Path(), $content->UpdatedAtTimestamp());
7783
}
78-
ContentsDatabase::NotifyContentsChange($content->UpdatedAtTimestamp());
7984
}
8085

8186
/**
@@ -96,6 +101,11 @@ public static function LoadRelatedIndex($contentPath) {
96101

97102
public static function RegistIndex($content){
98103
SearchEngine\Indexer::UnregistIndex($content->Path());
104+
105+
if(in_array('noindex', $content->Tags(), true)){
106+
return;
107+
}
108+
99109
SearchEngine\Indexer::RegistIndex($content->Path(), $content->Title());
100110
if (($parent = $content->Parent()) !== false) {
101111
SearchEngine\Indexer::RegistIndex($content->Path(), $parent->Title());

0 commit comments

Comments
 (0)