Forum

Thread tagged as: Question, Problem, Blog

Urlify Not Working

I have this <perch:blog id="postSlug" type="slug" editable="true" urlify="true" label="Blog Post Slug" for="postTitle" suppress="true" order="2" /> but urlify seems to have no effect. So plz nice url gets me plz%20nice%20url and not plz-nice-url as hoped. Transliteration functions look like they're available. What am I doing wrong?

Extended diagnostics.

Perch: 3.0.13
Production mode: Production (100)
Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), jw_activity_log (1.0.1), perch_blog (5.6.1), perch_forms (1.10)
DB driver: PDO
DB tables: perch3_blog_authors (4), perch3_blog_comments (70), perch3_blog_index (4311), perch3_blog_posts (60), perch3_blog_posts_to_tags (36), perch3_blog_sections (1), perch3_blog_tags (23), perch3_blog_webmention_queue (0), perch3_blogs (1), perch3_categories (4), perch3_category_counts (4), perch3_category_sets (1), perch3_content_index (192), perch3_content_items (54), perch3_content_regions (15), perch3_forms (0), perch3_forms_responses (0), perch3_jw_activity_log_actions (632), perch3_menu_items (12), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (1), perch3_pages (6), perch3_redfinch_optim_logs (0), perch3_redfinch_optim_settings (14), perch3_redfinch_optim_tasks (1), perch3_resource_log (192), perch3_resource_tags (9), perch3_resources (135), perch3_resources_to_tags (30), perch3_settings (36), perch3_user_passwords (1), perch3_user_privileges (46), perch3_user_role_privileges (15), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = [
        'perch_blog',
        'perch_forms',
    ];
Scheduled tasks for jw_activity_log: prune_actions_log (1440 mins)
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins)
Editor plug-ins: config.js, redactor-plugins
H1: 1c993da2c6134a7787e6259f6bce25e2
L1: 79bb31f336fb798129695c6cbce867af
F1: 3b606135b33e6a102526838f4152a807
headerColour: #e8e8e8
content_singlePageEdit: 1
helpURL:
hideBranding: 1
content_collapseList: 1
lang: en-gb
installedAt: 3.0
update_3.0: done
latest_version:
on_sale_version: 3.0.13
headerScheme: light
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_blog_update: 5.6
perch_blog_post_url: /{postSlug}
perch_blog_slug_format: {postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
logoPath: /perch/resources/perch-local-login-logo.png
perch_blog_site_name: Relative Paths
update_3.0.4: done
jw_activity_log_prune_time: 30
content_skip_region_list: 0
update_3.0.8: done
siteURL: https://localhost:3000/
keyboardShortcuts: 0
redfinch_optim_gc: 604800
redfinch_optim_timeout: 30
perch_blog_webmention_tx: 0
perch_blog_webmention_rx: 0
update_3.0.13: done
sidebar_back_link: 0
assets_restrict_buckets: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_PREFIX: perch3_
PERCH_TZ: Europe/London
PERCH_EMAIL_FROM: mark@pixelsmiths.co.uk
PERCH_EMAIL_FROM_NAME: Mark Phoenix
PERCH_LOGINPATH: /perch
PERCH_PATH: C:\Users\Mark\Documents\Web Design Local\host\relativepaths\perch
PERCH_CORE: C:\Users\Mark\Documents\Web Design Local\host\relativepaths\perch\core
PERCH_RESFILEPATH: C:\Users\Mark\Documents\Web Design Local\host\relativepaths\perch\resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_CUSTOM_EDITOR_CONFIGS: 1
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: relativepaths_local
PERCH_DEBUG: 1
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: f704e7442d11292c99b5
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: C:\Users\Mark\Documents\Web Design Local\host\relativepaths\perch\templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 7.0.10
Zend: 3.0.0
OS: WINNT
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $
MySQL server: 5.7.20
Free disk space: 584.97 GB
Extensions: Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, mcrypt, SPL, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, wddx, xmlreader, xmlwriter, apache2handler, openssl, curl, com_dotnet, fileinfo, gd, gettext, gmp, intl, imap, ldap, mbstring, exif, mysqli, Phar, pdo_mysql, pdo_sqlite, soap, sockets, sqlite3, xmlrpc, xsl, Zend OPcache, xdebug
GD: Yes
ImageMagick: No
PHP max upload size: 8M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 8M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_COOKIE: __utmc=111872281; __utmz=111872281.1515232219.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); cmsa=1; PHPSESSID=on6cqgk7rqbpfloh69a2p4d5p3; __utma=111872281.153966596.1515232219.1517385801.1517568522.29; __utmb=111872281.2.10.1517568522; io=vEX47yVKXgMug4UvAAA-
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.9,en;q=0.8
HTTP_ACCEPT_ENCODING: identity
HTTP_REFERER: https://localhost:3000/perch/core/settings/diagnostics/?extended
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CACHE_CONTROL: max-age=0
HTTP_CONNECTION: close
HTTP_HOST: relative-paths
PATH: C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\PuTTY\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Ruby22-x64\bin;C:\Users\Mark\AppData\Local\Microsoft\WindowsApps;C:\Users\Mark\AppData\Local\atom\bin;C:\Users\Mark\AppData\Roaming\npm;C:\Users\Mark\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps
SystemRoot: C:\WINDOWS
COMSPEC: C:\WINDOWS\system32\cmd.exe
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
WINDIR: C:\WINDOWS
SERVER_SIGNATURE: <address>Apache/2.4.29 (Win64) PHP/7.0.10 Server at relative-paths Port 80</address>
SERVER_SOFTWARE: Apache/2.4.29 (Win64) PHP/7.0.10
SERVER_NAME: relative-paths
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 80
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: C:/Users/Mark/Documents/Web Design Local/host/relativepaths
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: C:/Users/Mark/Documents/Web Design Local/host/relativepaths
SERVER_ADMIN: wampserver@wampserver.invalid
SCRIPT_FILENAME: C:/Users/Mark/Documents/Web Design Local/host/relativepaths/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 57366
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1517572534.531
REQUEST_TIME: 1517572534
Mark Phoenix

Mark Phoenix 0 points

  • 3 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

Mark,

have you tried it without urlify="true"? I have a feeling type="slug" includes urlify-ing anyway, so you're double-urlify-ing...

Drew McLellan

Drew McLellan 2638 points
Perch Support

As Duncan says, it makes little sense to use urlify on a slug, because that's its one job. What scenario is resulting in slug data that contains spaces? It should be urlified on the way in.

It's so a user can set or edit the post slug independently from the post title before publishing. I'm trying to guard against users entering a slug incorrectly. I'm still getting spaces and whatnot without urlify="true".

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not going to work with the Blog app. If you need control over the slug outside of the apps mechanism for formatting the slug, you'll need to add an additional field for it.

Is this what you mean? I have a separate field for the post slug (I inserted the dashes myself here). Perch CMS blog post title and blog post field

Drew McLellan

Drew McLellan 2638 points
Perch Support

From a picture of an interface? I have no idea what I'm looking at.

I thought that's what you mean by adding an additional field. Nevermind though, it's not important, I'm happy to leave this one here.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hi Mark,

I think urlify only works for output, so adding it to the edit form shouldn't make a difference.

If you are using postURL in your listing template, adding urlify to this tag should fix the slug in the URL, but you'll end up with a different slug on the URL from the actual one.

<perch:blog id="postURL" urlify="true" />

Even if you construct your links manually, you'd be be modifying the slug on output.

/blog/<perch:blog id="postSlug" urlify="true" />

When you add the following to your template:

<perch:blog id="postSlug" type="slug" editable="true" label="Blog Post Slug" for="postTitle" suppress="true" />

It shows the slug field on the edit form and makes it editable. When you enter postTitle, it automatically generates the slug for you. If you choose to manually edit the slug, you have to keep it URL-friendly as I don't think there's anything in place that stops you from entering spaces/special characters.