Using Content for Meta Description

Permalink
Dose anyone know how to use the first text line of the content of a page as meta description?

fjhadd
 
madeforspace replied on at Permalink Reply
madeforspace
Hi

Not sure how you would do this automatically but you can always copy and paste the text into the page properties.
Go to your site map, click on the page you want to add the tag to then select Page Properties and paste you text to the description field.

Hope that helps.
12345j replied on at Permalink Best Answer Reply
12345j
you can't do this by default, but with some fiddling you should be able to do it.
first copy root/concrete/blocks/content/view.php to root/blocks/content/view.php and then open that file up. replace everything in it with
<style type="text/css">
.ccm-break {
   display: none;
}
</style>
<?php
   defined('C5_EXECUTE') or die("Access Denied.");
   $content = $controller->getContent();
    $comment= explode("<hr class=\"ccm-break\" />",$content);
    $cData['cDescription']=strip_tags($comment[0]);
    echo $content;
?>
Then whenever you want to stop the page description in the content block, simply go to html mode and put <hr class="ccm-break" /> at where you want to stop it. Note that I have not tested this code but it should work, I'm not sure if thats how you set page description though, so maybe someone else could check it.