diff --git a/src/SEOTools/Contracts/MetaTags.php b/src/SEOTools/Contracts/MetaTags.php index 5a59df4..ffdaf85 100644 --- a/src/SEOTools/Contracts/MetaTags.php +++ b/src/SEOTools/Contracts/MetaTags.php @@ -141,6 +141,25 @@ public function removeMeta($key); */ public function addMeta($meta, $value = null, $name = 'name'); + /** + * Add a preload link meta tag. + * + * @param string $href + * @param string $as + * + * @return static + */ + public function addPreload($href, $as); + + /** + * Add a custom meta tag. + * + * @param string|array $meta + * + * @return static + */ + public function addCustom($meta); + /** * Sets the canonical URL. * diff --git a/src/SEOTools/Facades/SEOMeta.php b/src/SEOTools/Facades/SEOMeta.php index bdf09ca..1a1a7c1 100644 --- a/src/SEOTools/Facades/SEOMeta.php +++ b/src/SEOTools/Facades/SEOMeta.php @@ -18,6 +18,8 @@ * @method static \Artesaos\SEOTools\Contracts\MetaTags addKeyword(string|array $keyword) * @method static \Artesaos\SEOTools\Contracts\MetaTags removeMeta(string $key) * @method static \Artesaos\SEOTools\Contracts\MetaTags addMeta(string|array $meta, string|null $value = null, string $name = 'name') + * @method static \Artesaos\SEOTools\Contracts\MetaTags addPreload(string $href, string $as) + * @method static \Artesaos\SEOTools\Contracts\MetaTags addCustom(string $meta) * @method static \Artesaos\SEOTools\Contracts\MetaTags setCanonical(string $url) * @method static \Artesaos\SEOTools\Contracts\MetaTags setPrev(string $url) * @method static \Artesaos\SEOTools\Contracts\MetaTags setNext(string $url) diff --git a/src/SEOTools/SEOMeta.php b/src/SEOTools/SEOMeta.php index d4c05d6..9ab473f 100644 --- a/src/SEOTools/SEOMeta.php +++ b/src/SEOTools/SEOMeta.php @@ -62,6 +62,20 @@ class SEOMeta implements MetaTagsContract */ protected $metatags = []; + /** + * The preload links meta. + * + * @var string + */ + protected $preloads = []; + + /** + * The custom meta tags. + * + * @var string + */ + protected $custom = []; + /** * The canonical URL. * @@ -142,6 +156,8 @@ public function generate($minify = false) $description = $this->getDescription(); $keywords = $this->getKeywords(); $metatags = $this->getMetatags(); + $preloads = $this->getPreloads(); + $custom = $this->getCustoms(); $canonical = $this->getCanonical(); $amphtml = $this->getAmpHtml(); $prev = $this->getPrev(); @@ -181,6 +197,17 @@ public function generate($minify = false) $html[] = ""; } + foreach ($preloads as $preload) { + $href = $preload[0]; + $as = $preload[1]; + + $html[] = ""; + } + + foreach ($custom as $meta) { + $html[] = $meta; + } + if ($canonical) { $html[] = ""; } @@ -325,6 +352,28 @@ public function addMeta($meta, $value = null, $name = 'name') return $this; } + /** + * {@inheritdoc} + */ + public function addPreload($href, $as) + { + + $this->preloads[] = [$href, $as]; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addCustom($meta) + { + + $this->custom[] = $meta; + + return $this; + } + /** * {@inheritdoc} */ @@ -481,6 +530,26 @@ public function getMetatags() return $this->metatags; } + /** + * Get preload links. + * + * @return string + */ + public function getPreloads() + { + return $this->preloads; + } + + /** + * Get custom meta. + * + * @return string + */ + public function getCustoms() + { + return $this->custom; + } + /** * {@inheritdoc} */