Keywords subscribe, contact, journal, postcard in description marked as link to contact.php in new tab. Modified generate_content to include those words.
This commit is contained in:
parent
428e1f6b51
commit
30cffc211d
2 changed files with 13 additions and 1 deletions
|
|
@ -211,6 +211,7 @@ Content rules:
|
|||
- Roasting is allowed.
|
||||
- Profanity is allowed only if it fits the selected personality.
|
||||
- Do not invent specific facts that are not visible or provided.
|
||||
- Description MUST contain at least one of the following words (preferably more): subscribe, contact, postcard, journal. It's ok to use the same word mutliple times.
|
||||
|
||||
JSON rules:
|
||||
- Output JSON only.
|
||||
|
|
|
|||
13
index.php
13
index.php
|
|
@ -5,6 +5,13 @@ foreach (["videos_dir", "thumbs_dir", "uploads_dir"] as $d) if (!is_dir($config[
|
|||
if (!is_dir(__DIR__ . "/cache")) mkdir(__DIR__ . "/cache", 0775, true);
|
||||
|
||||
function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, "UTF-8"); }
|
||||
function render_description_html($s){
|
||||
$html = h($s);
|
||||
$linked = preg_replace_callback('/(?<![A-Za-z0-9_])(subscribe|contact|journal|postcard)(?![A-Za-z0-9_])/i', static function($m){
|
||||
return '<a class="description-contact-link" href="contact.php" target="_blank" rel="noopener noreferrer">' . $m[0] . '<span class="external-link-icon" aria-hidden="true">↗</span><span class="sr-only"> (opens in new tab)</span></a>';
|
||||
}, $html);
|
||||
return nl2br($linked ?? $html, false);
|
||||
}
|
||||
function nice_title($s){ return trim(ucwords(str_replace(['_','-'], ' ', (string)$s))); }
|
||||
function lower_text($s){ return function_exists('mb_strtolower') ? mb_strtolower((string)$s, 'UTF-8') : strtolower((string)$s); }
|
||||
function fold_text($s){
|
||||
|
|
@ -443,6 +450,10 @@ $siteHeaderTitle = $headerTitles[array_rand($headerTitles)];
|
|||
.video-info .meta{margin:0 0 .45rem}
|
||||
.description-teaser{margin:.15rem 0 .45rem;color:#EADFC9}
|
||||
.description-quote{margin:.15rem 0 .45rem;font-style:italic;font-size:.82rem;color:#D6D9DE}
|
||||
.description-contact-link{color:#3BA7A0;text-decoration:underline;text-underline-offset:.12em}
|
||||
.description-contact-link:visited{color:#3BA7A0}
|
||||
.description-contact-link:hover,.description-contact-link:focus-visible{color:#4fb9b2}
|
||||
.external-link-icon{font-size:.78em;margin-left:.15em;vertical-align:.12em}
|
||||
#videos .video-wrapper{align-self:start}
|
||||
#videos .video-info{align-self:start}
|
||||
#videos .video-info .description{margin-top:0}
|
||||
|
|
@ -525,7 +536,7 @@ $siteHeaderTitle = $headerTitles[array_rand($headerTitles)];
|
|||
<?php if(!empty($m['location'])): ?><a class="meta-filter" href="<?=h($locFilterUrl)?>" title="Filter by location"><?=h($m['location'])?></a><?php endif; ?>
|
||||
</p>
|
||||
<?php if(!empty($m['teaser'])): ?><p class="description-teaser description-teaser-desktop"><?=h((string)$m['teaser'])?></p><?php endif; ?>
|
||||
<?php if(!empty($m['description'])): ?><p class="description"><?=nl2br(h($m['description']), false)?></p><?php endif; ?>
|
||||
<?php if(!empty($m['description'])): ?><p class="description"><?=render_description_html($m['description'])?></p><?php endif; ?>
|
||||
<?php if(!empty($m['quote_da'])): ?><p class="description-quote">“<?=h(trim((string)$m['quote_da'], "\"“”"))?>”</p><?php endif; ?>
|
||||
</div>
|
||||
</article>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue