Skip to content

Commit

Permalink
FEAT: http-equiv q'n dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
ANAGNOSTOPOULOS Konstantinos committed Dec 12, 2018
1 parent 75d777c commit f33ad92
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/OutputPageHtmlTagsInserter.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public function addTagContentToOutputPage( $tag, $content ) {
return $this->addMetaPropertyMarkup( $tag, $content );
}

if ( $this->reqMetaHttpEquivs( $tag ) ) {
return $this->addMetaHttpEquivMarkup( $tag, $content );
}

$this->outputPage->addMeta( $tag, $content );
}

Expand Down Expand Up @@ -140,4 +144,30 @@ private function reqMetaPropertyMarkup( $tag ) {
return false;
}

private function reqMetaHttpEquivs( $tag ) {

// If a tag contains a `og:` such as `og:title` it is expected to be a
// OpenGraph protocol tag along with other prefixes maintained in
// $GLOBALS['smtgMetaPropertyPrefixes']
return in_array( $tag, $GLOBALS['smtgMetaHttpEquivs'] );
}

private function addMetaHttpEquivMarkup( $tag, $content ) {

$comment = '';

if ( !$this->metaPropertyMarkup ) {
$comment .= '<!-- Semantic MetaTags -->' . "\n";
$this->metaPropertyMarkup = true;
}

$content = $comment . \Html::element( 'meta', [
'http-equiv' => $tag,
'content' => $content
] );

$this->outputPage->addHeadItem( "meta:property:$tag", $content );
}


}

0 comments on commit f33ad92

Please sign in to comment.