diff --git a/README.md b/README.md
index e1ff3f9..b9a8c59 100644
--- a/README.md
+++ b/README.md
@@ -116,6 +116,7 @@ To add more tags to the head, you can use the `tag()` and `rawTag()` methods:
```php
seo()->tag('fb:image', asset('foo'));
seo()->rawTag('');
+seo()->rawTag('fb_url', ''); // Keyed, allows overrides later on
```
### Canonical URL
diff --git a/src/SEOManager.php b/src/SEOManager.php
index 53ee799..82f42b9 100644
--- a/src/SEOManager.php
+++ b/src/SEOManager.php
@@ -191,9 +191,11 @@ class SEOManager
}
/** Add a head tag. */
- public function rawTag(string $tag): static
+ public function rawTag(string $key, string $tag = null): static
{
- $this->tags[] = $tag;
+ $tag ??= $key;
+
+ $this->tags[$tag] = $tag;
return $this;
}
@@ -201,7 +203,7 @@ class SEOManager
/** Add a meta tag. */
public function tag(string $property, string $content): static
{
- $this->rawTag("");
+ $this->rawTag("meta.{$property}", "");
return $this;
}
diff --git a/tests/Pest/ManagerTest.php b/tests/Pest/ManagerTest.php
index c12a040..50840b2 100644
--- a/tests/Pest/ManagerTest.php
+++ b/tests/Pest/ManagerTest.php
@@ -90,11 +90,18 @@ test('meta tags can be added to the template', function () {
});
test('raw tags can be added to the template', function () {
- seo()->rawTag('');
+ seo()->rawTag('foo', '');
expect(meta())->toContain('');
});
+test('raw tags can be overridden', function () {
+ seo()->rawTag('foo', '');
+ seo()->rawTag('foo', '');
+
+ expect(meta())->toContain('');
+});
+
test('canonical url is not included by default', function () {
expect(meta())
->not()->toContain('og:url')