Forum
Help troubleshooting Blog Post title URL
Hello,
I'm using Perch Runway 2.8.32 and Blog 5.0. Attached summary diagnostics for both of my environments at end of post.
This is my blog post Title field in my post.html
template:
<perch:blog id="postTitle" type="text" label="Title" size="xl autowidth" required="true" order="1" />
This is my blog post Title field in my post_in_list.html
template:
<a href="/news/<perch:blog id="postSlug" />" rel="bookmark" class="entry-title"><perch:blog id="postTitle" /></a>
My problem is that in my live server environment, I'm getting some results that I don't get in my development environment and I'm not sure where to begin troubleshooting the issue.
There is a post with a title of "Our Academy is a Level 1+ School!".
In my development environment the output URL from my post_in_list.html
template is:
https://goodestemacademy.dev/news/2016-10-07-our-academy-is-a-level-1-school
and this works and directs me to the post.
In my live environment the output URL includes the +
character and the link produces a "page cannot be found" result:
https://goodestemacademy.org/news/2016-10-07-our-academy-is-a-level-1+-school
I've checked all my routes between environments and they are identical and sorted in the same order.
Also my routing token in both environments is:
'blogslug' => '[1-2][0-9]{3}\-[0-9]{2}\-[0-3][0-9]-[a-z0-9\-]+',
Any guidance or advice, to at least know where to begin troubleshooting is appreciated.
Here is my development perch diagnostics:
Perch Runway: 2.8.32, PHP: 5.6.24, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), jw_activity_log (1.0.1), collection_3 (2.8.32), collection_4 (2.8.32), collection_5 (2.8.32), perch_blog (5.0), collection_1 (2.8.32)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /cms
PERCH_PATH: C:\xampp\htdocs\goodestemacademy\cms
PERCH_CORE: C:\xampp\htdocs\goodestemacademy\cms\core
PERCH_RESFILEPATH: C:\xampp\htdocs\goodestemacademy\cms\resources
Image manipulation: GD
PHP limits: Max upload 50M, Max POST 50M, Memory: 128M, Total max file upload: 50M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: goodestemacademy.dev
DOCUMENT_ROOT: C:/xampp/htdocs/goodestemacademy
REQUEST_URI: /cms/core/settings/diagnostics/
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
And here is my live perch diagnostics:
Perch Runway: 2.8.32, PHP: 5.6.27, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), jw_activity_log (1.0.1), collection_3 (2.8.32), collection_4 (2.8.32), perch_blog (5.0), collection_1 (2.8.32)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /cms
PERCH_PATH: /home1/ichernan/public_html/goodestemacademy/cms
PERCH_CORE: /home1/ichernan/public_html/goodestemacademy/cms/core
PERCH_RESFILEPATH: /home1/ichernan/public_html/goodestemacademy/cms/resources
Image manipulation: GD Imagick
PHP limits: Max upload 50M, Max POST 50M, Memory: 128M, Total max file upload: 50M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
DOCUMENT_ROOT: /home1/ichernan/public_html/goodestemacademy
HTTP_HOST: goodestemacademy.org
REQUEST_URI: /cms/core/settings/diagnostics/
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
Just a quick update:
I tested the same post title with two other websites I have on the same web hosting account. These two sites are built with Perch, not Runway, but I see the same results.
I know its not an issue isolated to Perch or Runway. It's an environment issue, but not sure where to begin troubleshooting. Please advise.
Thank you!
Does this happen after you have imported the data from dev to live or is it happening on creating a new post on the server?
Hi Rachel,
My client created the post on the live server and that's when I noticed the issue. So no import from dev to live, except for when I uploaded the full website months ago.
I tried to reproduce the issue on my local development server, but everything seems to work fine there. So I checked and uploaded all my templates again, double-checked that my routes and tokens were the same between environments.
I tried adding other characters, but only the "+" character seems to stay on my live server blog posts. I also tried adding a "+" to other post entry titles and they are also not being removed on my live server.
Can you post your extended diagnostics for the live server?
Hi Drew,
Here's my extended report for the live server:
Ok, it looks like you have transliteration available.
Can you give an example of the input and the output you're getting?
Not sure if I understand if this is what you're asking for, but please let me know.
So on my live server, for testing I created a blog post in the admin panel that includes some common characters:
and the post title above displays just fine.
However, the URL output is still including the
+
character and I get a 'page cannot be found' error if I click on the link:and if I remove the
+
character, the link works and takes me to my blog post.For the URL of the post, I'm using
postSlug
like this in my template:I think it's probably because the default slug token doesn't include
+
as it has a special meaning in URLs.If you're doing to use a plus in your URLs you might need to specify a custom token to handle it.
Hello,
I have not specified a custom token yet. I understand the default slug token doesn't include
+
, but in that case I don't understand why upon saving is the+
symbol not being removed from the URL then? I followed the documentation for setting up my blog in Runway (https://docs.grabaperch.com/addons/blog/runway/config/) and I'm begining to wonder if there may be something else wrong.I have another blog post that is displaying a "Page not Found" error message when I select the blog post from my list of posts. Same client, nothing has changed as far as configuration and setup. I checked the error log and the last entry dates back to Oct. 23rd. This time the title of the post is simply
Parent Informational Meeting for 2018 Spring Break Trip
and the output URL appears to be fine:https://goodestemacademy.org/news/2016-11-07-parent-informational-meeting-for-2018-spring-break-trip
.The post is on the live website if you have a moment to take a look. Other posts are working fine, but this one produces a "Page not Found" error for some reason.
Please help!
You have a zero-width space character before the P of Parent.
Drew,
Wow, if you don't mind me asking, how were you able to see this character?
I cleared out the title and inserted just 'title', then manually retyped the original title of the post and it's working fine now. My guess is that my client probably copy and pasted the code from a Word document??
Would any perch tag attributes be helpful to avoid this in the future? Like the escape, urlencode, or urlify tag attributes?
If I added any of these attributes to my tag though, would that cause any issues with my default routing token since I assume these attributes would introduce other characters?
I have super powers.
Actually, you can see it encoded into an HTML entity in the source.
That would be my assumption. It's very hard to strip out junk that Word inserts without accidentally damaging good content in the process. In the 15 or so years I've been building content management systems, the only reliable way I've found to avoid it is to never copy and paste from Word.
After seeing the previews to Perch 3, I might actually believe the super powers.
Regarding copying from Word, I'll make sure to point this out to my client. Thanks for your help.
I haven't closed this thread though because while I understand you suggested I would need to specify a custom token, I'm not sure what my custom token should be? Also, how would I reference my customized token versus the default token? Would I simply need to change my
Blog post page path
value under Settings...or does it go beyond that to my templates, etc.?I'm not sure I follow what you're asking about the custom token.
I have this as my default and only routing token for my blog posts in my runway.php file:
The issue I had was that my client added a post containing a
+
character in the title: (e.g. Our Academy is a Level 1+ School!)In my local development environment the
+
character is removed and the link (e.g. 2016-10-07-our-academy-is-a-level-1-school) works fine, but in my live environment the '+' character is not removed and the link (e.g. 2016-10-07-our-academy-is-a-level-1+-school) produces a "Page Cannot be Found" error.Earlier in the thread you suggested:
So that's where I'm a bit lost. I see 2 options: modify my default token or leave the default as is and add a custom token.
If I modify the default token, how would I need to modify my
blogslug
routing token to include the+
character?If I go with adding a custom token, how would that token look or be structured? To reference this custom token would I need to change my
blog post page path
value under Settings? Currently:/news/{postSlug}
.Where you have
[a-z0-9\-]
use[a-z0-9\-\+]
Thanks Drew.
I now have:
and I reinserted the title and saved the post again.
Unfortunately, I was still getting a "Page could not be found" result. Luckily, I went back and read the notes for Routing Tokens in my runway.php file and noticed that I needed to
re-save the page options for the change to take effect
. So I resubmitted my Page Options settings for my News and Post pages, and now the link works perfectly.Thanks for all your help again!