Skip to content

Commit dc455dd

Browse files
committed
add current meta tags to prompts
1 parent 5a8a414 commit dc455dd

File tree

8 files changed

+51
-8
lines changed

8 files changed

+51
-8
lines changed

snippets/prompts/introduction.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
- Preserve as much of the original as possible
3232
- Keep the same style, tone, and structure
3333
- Change ONLY the specific parts mentioned in the instructions below
34-
- If no specific change is mentioned for something, leave it unchanged
3534
</primary-editing-task>
3635
<?php endif ?>
3736

snippets/prompts/meta.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
<?php
22

33
/** @var \Kirby\Cms\Page $page
4-
** @var \Kirby\Cms\Site $site */
4+
** @var \Kirby\Cms\Site $site
5+
** @var string|null $currentField */
56

67
$meta = $page->metadata();
8+
$currentField = $currentField ?? null;
9+
10+
$metaFields = [
11+
'metaTitle' => 'Meta Title',
12+
'metaDescription' => 'Meta Description',
13+
'ogTitle' => 'Open Graph Title',
14+
'ogDescription' => 'Open Graph Description'
15+
];
16+
?>
17+
18+
<existing-metadata>
19+
<?php foreach ($metaFields as $key => $label) : ?>
20+
<?php
21+
$value = $meta->get($key);
22+
if ($currentField === $key || !$value || $value === '') {
23+
continue;
24+
}
25+
?>
26+
<<?= $key ?>><?= $value ?></<?= $key ?>>
27+
<?php endforeach ?>
28+
</existing-metadata>

snippets/prompts/site-meta.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
<?php
22

3-
/** @var \Kirby\Cms\Site $site */
3+
/** @var \Kirby\Cms\Site $site
4+
** @var string|null $currentField */
5+
6+
$currentField = $currentField ?? null;
7+
8+
$metaFields = [
9+
'metaDescription' => 'Site Meta Description',
10+
'ogDescription' => 'Site Open Graph Description',
11+
'ogSiteName' => 'Site Name'
12+
];
13+
?>
14+
15+
<existing-site-metadata>
16+
<?php foreach ($metaFields as $key => $label) : ?>
17+
<?php
18+
$value = $site->$key()->value();
19+
if ($currentField === $key || !$value || $value === '') {
20+
continue;
21+
}
22+
?>
23+
<<?= $key ?>><?= $value ?></<?= $key ?>>
24+
<?php endforeach ?>
25+
</existing-site-metadata>

snippets/prompts/tasks/description.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
You'll receive the content of the page as well as any meta tags that are already set below.
2121
</task>
2222

23-
<?php snippet('seo/prompts/meta');
23+
<?php snippet('seo/prompts/meta', ['currentField' => 'metaDescription']);
2424
snippet('seo/prompts/content');

snippets/prompts/tasks/og-description.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
You'll receive the content of the page as well as any meta tags that are already set below.
2222
</task>
2323

24-
<?php snippet('seo/prompts/meta');
24+
<?php snippet('seo/prompts/meta', ['currentField' => 'ogDescription']);
2525
snippet('seo/prompts/content');

snippets/prompts/tasks/og-site-description.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
You'll receive the content of the home page as well as any meta tags that are already set below.
2222
</task>
2323

24-
<?php snippet('seo/prompts/site-meta');
24+
<?php snippet('seo/prompts/site-meta', ['currentField' => 'ogDescription']);
2525
snippet('seo/prompts/content'); ?>

snippets/prompts/tasks/site-description.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
You'll receive the content of the home page as well as any meta tags that are already set below.
2121
</task>
2222

23-
<?php snippet('seo/prompts/site-meta');
23+
<?php snippet('seo/prompts/site-meta', ['currentField' => 'metaDescription']);
2424
snippet('seo/prompts/content'); ?>

snippets/prompts/tasks/title.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
If useful for the customers niche, include a keyword for the location. AVOID for global companies or niche subpages.
3636
</task>
3737

38-
<?php snippet('seo/prompts/meta');
38+
<?php snippet('seo/prompts/meta', ['currentField' => 'metaTitle']);
3939
snippet('seo/prompts/content');

0 commit comments

Comments
 (0)