Open mthu opened 6 years ago
Hi @mthu, thanks for your patch ;)
Fixed!
At your disposal, Joseph
I've looked at this and it seems to take the heading of the page and just the first 250 or 500 characters with \n (line breaks) which do not render well with Google SERP.
I suggest replacing the line breaks with Full Stops (.) and a space character. Which would make things read a lot better.
Just for interest my code for that is:
public function getDescription() { return (@$this->meta['description']['abstract'] ? str_replace("\n\n",". ",$this->meta['description']['abstract']): $this->getTitle()); }
Which looks like this when checked in google semantic checker:
Hi, at following line, ltrim function is called improperly. The second argument is a set of characters, not a string prefix, so it does not strip the whole title from the beginning of the abstract as probably expected but it can strip more than that. https://github.com/LotarProject/dokuwiki-plugin-semantic/blob/3d4d0233fdf169fb393884ee80cf68fc9b95294f/helper.php#L83
This leads to bad behavior. For example, having: Abstract: "Adding a LDAP directory as a contact source for Thunderbird can be quite tricky .... " Title: "Thunderbird LDAP via SSL with self-signed certificate" is leading to output: "ory as a contact source for Thunderbird can be quite tricky ...."
In my Dokuwiki instance, the abstract is not prefixed with the page title, so no stripping is needed. Instead, something like this works for me (use title if no abstract is present):