did not solve anything.
Would be helpful to have the error message you get for the highlighted line?
I had the same problem when I updated to PHP 7.1 and set it to array works.
Iāve updated the repo: https://github.com/jenstornell/kirby-seo/blob/master/seo.php
Hi, i just finished my install and everything works except a visual thing.
When previewing the search, if the title or text used as fallbacks contain one ā or various ', the preview is not working.
For example with a title named "Testā ", the plugin returns this.
Sorry for the screencap but for some reason part of the double quotes turn into this:
<div class="seo" data-seo-controller="{"values":{"sitename":"blog name","pagename":"Test" ","content":"hello"},"title":{"field":"","template":"{{pagename}}","prefix":"","suffix":"="" on="" blog="" name","backup":"{{pagename}}","fallback":"{{pagename}}","full":"{{pagename}}="" {{sitename}}","full-replaced":"test'="" name"},"description":{"field":"","template":"{{content}}","backup":"{{content}}","fallback":"{{content}}","full":"{{content}}","full-replaced":"hello","prefix":"","suffix":"","limit":155},"url":{"edit":"http:\="" \="" kirby.sites.dev\="" panel\="" pages\="" blog\="" test\="" url","preview":"kirby.sites.dev\="" test"}}'="">
Each ā seems to be replaced by " which breaks the data-seo-controller attribute content. I donāt know what could create something like this so I need your help. Iām using Kirby 2.4.1.
plugin broke with 2.5.0
Undefined index: scheme in file /plugins/seo/core/core.php on line 290
I bet itās related to this issue: https://github.com/getkirby/kirby/issues/588
If $page->url()
is not a full url, I guess it will fail.
are you gonna fix it?
we have stuck on 0.5 for so long and i implemented serp preview on a few projects and would be annoying to either revert everything or not being able to update.
No. Itās not really an issue in the plugin, it was Kirby 2.5.0. Therefor a fix in the plugin would be a hack.
But you can now fix it by upgrading Kirby again or as a workaround set the site url in config.php.
Why there has been no update since 0.5 is because of this problem. I got tired of breaking my multi language site with Kirby SEO for an unknown reason.
But I agree that a new version soon would be nice. The same goes for a few other of the plugins, like Revisions, Reveal etc.
2.5.1 seems to work yes.
I had a bit of time to come back to my initial problem. Having ā or " in the text and title broke the Json in data-seo-controller.
Dirty/rapid fix in core.php, getvalues function:
// Get values
public static function getValues($array, $arrays) {
if( isset( $arrays ) ) {
foreach( $arrays as $item ) {
foreach( $item['values'] as $key => $value ) {
//$array['values'][$key] = (string)$value; <- original code
$array['values'][$key] = str_replace('"', "\"", str_replace("'", "'", (string)$value));
}
}
}
return $array;
}
Hope it helps, thanks for the great plugin @jenstornell.
Thanks! A new release for Kirby SEO is still not around the corner, sorry. But I have plans in the future for a complete rewrite and maybe your code could be useful at that point.
@Thomasorus There is a pull request that fixes this problem, already waiting to be incorporated into the code. The fix is very simple - less than one line - so if you canāt wait, you can just view it in GitHub, and copy it directly into your code.
@jenstornell This is one of my most favourite plugins for Kirby. I have noticed that some pull requests have been in the queue for a while, and this makes me concerned that you might have given up on further development. Please, please tell me that this is not true!
You are right, it has been a while. The reason I stopped working on it was because of a multi language Kirby bug. Maybe it has been fixed now, I have not tested it yet: Really strange behavior that makes Kirby save to wrong content file
Now there is a development going in with Kirby 3. You can buy to get more information about that with https://getkirby.com/next
I canāt tell you anything on what it will be, but the changes are so big that I need a complete rewrite of Kirby SEO, which I had already planned because of the ugly code. It might not be good news but instead of building two plugins from scratch I will wait until Kirby 3 is released and build the plugin from scratch to that version only.
If you still want some progress with the current version you can add pull requests and also write comments on each others pull requests if they work or not and I can just approve them.
Anyway, if I get the time, I should be able to start over with the new plugin before Kirby 3 but that will be to clean up the plugin core and nothing around the field itself.
I expect the new version to be released in the mid or late 2018.
Very happy to hear that Kirby SEO will continue to live a long and prosperous life, @jenstornell! Thank you for your continuing work - itās truly appreciated.
The plugin, āas-isā - coupled with a couple of the fixes already submitted - is already extremely useful, and helpful in making users understand how important ātitleā and ādescriptionā are - and how to compose better ones.
Iāll certainly keep using it, and if I come across anything that I can āfixā, I certainly will.
Once again, thank you for your great work - itās truly appreciated!
When using this plugin, I find that the āTitleā field is often unnecessary in the Panel. Is there a way to totally hide the Title field - rather than just make it āreadonlyā, but still showing?
You mean the panel title
field? You can just remove it from the blueprint. Itās no longer required.
Sorry about reviving this topic @jenstornell!
I just wanted to post an update for the few people like me that are migrating out of this plugin. Hereās how I transformed my content files using regex commands. Itās just a small guide that may not completely work with your content so no garanties. Be sure to make copies of your content folder!
Case 1: All fields are filled:
----
Seo:
-
seo-title: "This is my SEO title"
seo-description: "This is my SEO description"
----
Case 2: Only title is filled:
----
Seo:
-
seo-title: "This is my SEO title"
seo-description: ""
----
Case 3: Only description is filled:
----
Seo:
-
seo-title: ""
seo-description: "This is my SEO description"
----
Case 4: Thereās just the parent field:
----
Seo:
----
Case 5: All fields exist but are empty:
----
Seo:
-
seo-title: ""
seo-description: ""
----
Iām not that good with regex so I did it in multiple steps. Here are the regex I used. You can see in the links the regex to select the text, the text itself and the replacement regex.
For cases 1, 2, 3 and 5, I used these 3 steps in visual studio code:
- Removing the Seo block and renaming the title while also removing the double quote at the start of the title: https://regexr.com/48gqt
- Removing the double quote at the end of the title, separating and renaming seo-description, and removing the double quote again at the start of the description: https://regexr.com/48gr0
- Removing the last double quote at the end of the description. For this I checked what was the next field in my files and it was keywordmap, so I did this: https://regexr.com/48gr3
For cse 4, I used this single regex:
- Remove the block and just leave a separator line: https://regexr.com/48gr6
For the snippet header, I just used a simple condition:
<title>
<?php
if(!$page->seotitle()->isEmpty()) {
echo $page->seotitle();
}
else {
echo $page->Title();
}
?>
</title>
<meta name="description" content="
<?php
if(!$page->seodescription()->isEmpty()) {
echo $page->seodescription();
}
else
{
echo $page->text()->excerpt($chars = 240, $strip = true, $rep = 'ā¦');
}?>
">
And thatās it, hope it helps!
No sorry. I hope someone will take over.