Skip to content

Commit 5e5866b

Browse files
authored
Update blog.php
proper escaping content preview meta tag for permalinks
1 parent 23cd42b commit 5e5866b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

microblog/blog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function renderBlog(){
4141
while( (!$listPosts && $currentPost > $firstPost-blogPostsPerPage && $currentPost>0) || ($listPosts && $currentPost > 0) ){
4242
$filename=dirname(__FILE__)."/content/".$currentPost.'.html';
4343
$content = file_get_contents($filename);
44-
$content_preview = strip_tags(preg_replace('/^.+\n/', '', $content));
44+
$content_preview = preg_replace('/^.+\n/', '', htmlspecialchars(preg_replace("#<(.*)/(.*)>#iUs", "", $content)));
4545
$title=strtok($content, "\n");
4646
if($permaLink!==false){
4747
echo("<meta itemprop=\"name\" content=\"$title\">");

0 commit comments

Comments
 (0)