Hello everyone,
Please forgive the poor quality of my English. It's not my language, and I trust Google for translation.
After browsing the website and forum, I decided to test WonderCMS with the latest available version. I'm not a developer, so I'm not familiar with the code. However, I'm not disappointed; my limited knowledge of CSS is enough to make a few style changes. Thanks to the creators.
But I'm contacting you about a problem with the SimpleBlog plugin. The field where keywords are entered seems to have a problem because the keywords don't appear in the source code. Instead, I get the text in the description, with all the words separated by a comma.
Here's an example of the source code I got for testing:
meta name="description" content="The text in the description field appears like this in the source code."
meta name="keywords" content="The, text, in, the, description, field, appears, like, this, in, the, source, code."
I checked the database; the description and keywords are correct.
My PHP version is 8.2. Could that be the problem?
SimpleBlog
Re: SimpleBlog
Hey gupa,
What you experience with keywords and description field is really odd. Keywords output is inside post meta tag:
You could try enabling default Sky theme and check if the problem is present.
(Edit) System requirements for Wonder CMS: https://www.wondercms.com/docs/#requirements
What you experience with keywords and description field is really odd. Keywords output is inside post meta tag:
Code: Select all
<p class="meta">21 April 2025<br> keyword, keyword</p>
(Edit) System requirements for Wonder CMS: https://www.wondercms.com/docs/#requirements
Re: SimpleBlog
Yes, at the tag level: p class="meta", there's no problem; the keywords and the date are present.
I only notice the problem in the header between the <head> and </head> tags.
To be sure I hadn't made any bad changes, I uploaded an unmodified version of the Sky theme to the server. I also tested two other themes.
But whether I enter keywords for the article or not, I get the same result.
I only notice the problem in the header between the <head> and </head> tags.
To be sure I hadn't made any bad changes, I uploaded an unmodified version of the Sky theme to the server. I also tested two other themes.
But whether I enter keywords for the article or not, I get the same result.
Re: SimpleBlog
Yes, I see it now too, inside the head tag. Not sure if this is done intentionally but it takes description field content as keywords, but not the post title or post keywords. Although, post keywords are introduced with the latest Wonder CMS version.
Re: SimpleBlog
I changed the last bit of code inside simple-blog/class.SimpleBlog.php. First, make a class.SimpleBlog.php backup, just in case something goes wrong.
Find this bit of code (at the end of document):
replace with this:
Now keywords are displayed inside head meta tags. I cant' vouch for the new code syntax.
Find this bit of code (at the end of document):
Code: Select all
private function setMetaTags(array $args): array {
$subPage = strtolower($this->Wcms->currentPage);
if ((($subPage !== $this->slug && isset($this->db->posts->{$subPage})) || $subPage === $this->slug)
&& isset($args[1])
&& ($args[1] === 'title' || $args[1] === 'description' || $args[1] === 'keywords')
) {
$args[0] = isset($this->db->posts->{$subPage})
? $this->db->posts->{$subPage}->{$args[1] === 'keywords' ? 'description' : $args[1]}
: $this->db->title;
$length = strrpos(strip_tags($args[0]), ' ');
$content = strip_tags($args[0]);
if ($args[1] === 'title') {
$args[0] = $length > 60 ? substr($content, 0, 57) . "..." : $content;
} elseif ($args[1] === 'keywords') {
$args[0] = str_replace(' ', ', ', $content);
} elseif ($args[1] === 'description') {
$args[0] = $content;
}
}
return $args;
}
}
Code: Select all
private function setMetaTags(array $args): array {
$subPage = strtolower($this->Wcms->currentPage);
if ((($subPage !== $this->slug && isset($this->db->posts->{$subPage})) || $subPage === $this->slug)
&& isset($args[1])
&& ($args[1] === 'title' || $args[1] === 'description' || $args[1] === 'keywords')
) {
if (isset($this->db->posts->{$subPage})) {
if ($args[1] === 'keywords') {
$args[0] = $this->db->posts->{$subPage}->keywords;
} elseif ($args[1] === 'description') {
$args[0] = $this->db->posts->{$subPage}->description;
} else {
$args[0] = $this->db->posts->{$subPage}->{$args[1]};
}
} else {
$args[0] = $this->db->title;
}
$length = strrpos(strip_tags($args[0]), ' ');
$content = strip_tags($args[0]);
if ($args[1] === 'title') {
$args[0] = $length > 60 ? substr($content, 0, 57) . "..." : $content;
} elseif ($args[1] === 'keywords') {
$args[0] = $content;
} elseif ($args[1] === 'description') {
$args[0] = $content;
}
}
return $args;
}
}
Re: SimpleBlog
Thanks for this solution, it works perfectly 
