Thread tagged as: Question, Blog

Slug format in URL

Hi there I have an offers site which utilises the blog app. In a BID to improve SEO, I am keen for the company name which is currently a field in the template to be in the URL as well as the title of the post.

For example this page:

Would say the following instead:

I have altered the slug in Settings in the CMS but I can't get it to work.

I've tried altering the slug format: posted-on-%d-%m-%Y-{postTitle} ... removing posted-on- which I added manually to prevent multiple offers appearing on the same page but I can't get {companyName} to work like {postTitle} does.

Before I try further I thought I'd post here in case what I wanted wasn't possible to save me wasting any time.

If you could advise I would be grateful.

Many thanks


Rich Hemery

Rich Hemery 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Where is {companyName} set?

Have you created a new post since changing the settings? It won’t change existing posts.

Thanks for getting back to me Drew.

It's being set in the default post.html template for when I create a new offer (blog).

The code is: <perch:blog id="CompanyName" label="Company name" type="text" html="false" encode="false" required="true"/>

Which works fine at displaying the Company Name on the web pages but when I amend the slug in settings to: posted-on-%d-%m-%Y-{postTitle}-at-{CompanyName}

No Company Name appears - e.g:

I have gone back and re-published the above offer to test. I've also created a brand new post and still no luck.

Any ideas?



Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostic report?


I know I'm on an old version of both the CMS (and I think the blog?) so I can update this tonight but if you spot anything amiss please let me know.

Perch: 2.8.27 Production mode: Production (100) Installed apps: content (2.8.27), assets (2.8.27), categories (2.8.27), ketterus_dashboard (1), perch_blog (5.0), perch_members (1.1), perch_backup (1.2) DB driver: PDO DB tables: perch2_blog_authors (51), perch2_blog_comments (0), perch2_blog_index (18491), perch2_blog_posts (472), perch2_blog_posts_to_tags (328), perch2_blog_sections (1), perch2_blog_tags (198), perch2_blogs (1), perch2_categories (7), perch2_category_counts (7), perch2_category_sets (1), perch2_content_index (383), perch2_content_items (144), perch2_content_regions (74), perch2_events (8), perch2_events_categories (9), perch2_events_to_categories (16), perch2_mailchimp_campaigns (7), perch2_mailchimp_history (1), perch2_mailchimp_log (0), perch2_mailchimp_stats (1), perch2_mailchimp_subscribers (1324), perch2_members (375), perch2_members_forms (2), perch2_members_member_tags (373), perch2_members_sessions (1), perch2_members_tags (2), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (3), perch2_pages (18), perch2_resource_log (1622), perch2_resource_tags (266), perch2_resources (1743), perch2_resources_to_tags (543), perch2_settings (51), perch2_user_passwords (7), perch2_user_privileges (43), perch2_user_role_privileges (17), perch2_user_roles (2), perch2_users (90) Users: 90 App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_blog', ); Scheduled tasks for perch_blog: delete_spam_comments (1440 mins) Editor plug-ins: markitup, ckeditor H1: cd6ada9f059381dd87260e2bd3d66fe8 L1: ccb4dd0acb2a2abe158e8e0be020d750 F1: 2edba60ed1f613d6dd804feb202456a2 headerColour: #024d8a content_singlePageEdit: 1 hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.7.5: done latest_version: 2.8.15 on_sale_version: headerScheme: dark dashboard: 1 hide_pwd_reset: 0 content_hideNonEditableRegions: 1 content_frontend_edit: 0 perch_events_update: 1.8 perch_mailchimp_secret: fe1380f9ac6968b8424d0d88ae5e019a perch_mailchimp_update: 2.0 perch_mailchimp_api_key: ecfdb21a79c4e9eb3dbea838bcdbe6f6-us3 perch_mailchimp_campaign_url: /mailchimp/campaign.php?s={campaignSlug} perch_members_login_page: /members perch_events_detail_url: /offers/offer.php?event={eventSlug} perch_mailchimp_list_id: 6ae209733b siteURL: perch_backup_mysqldump_path: logoPath: /perch/resources/1422895817_love-bedford-offers-logo.png helpURL: update_2.7.10: done perch_blog_update: 5.0.1 perch_blog_post_url: /offers/offer.php?s={postSlug} perch_blog_slug_format: posted-on-%d-%m-%Y-{postTitle}-at-{CompanyName} perch_blog_akismet_key: perch_blog_max_spam_days: 0 perch_blog_comment_notify: 0 update_2.8.27: done perch_blog_site_name: PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: PERCH_DB_SERVER: PERCH_DB_DATABASE: PERCH_DB_PREFIX: perch2_ PERCH_TZ: UTC PERCH_EMAIL_FROM: PERCH_EMAIL_FROM_NAME: Love Bedford Offers PERCH_LOGINPATH: /perch PERCH_PATH: /var/sites/l/ PERCH_CORE: /var/sites/l/ PERCH_RESFILEPATH: /var/sites/l/ PERCH_RESPATH: /perch/resources PERCH_HTML5: 1 PERCH_CLEAN_RESOURCES: PERCH_MEMBERS_SESSION_TIME: 30 DAYS PERCH_SECURITY_HEADERS: 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_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /var/sites/l/ PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_SESSION_TIMEOUT_MINS: 20 HOSTING SETTINGS PHP: 5.6.37 Zend: 2.6.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: MySQL server: 5.6.21 Free disk space: 33.28 TB Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, fileinfo, filter, ftp, gettext, gmp, SPL, iconv, session, intl, json, mbstring, mcrypt, mssql, standard, mysqlnd, pcntl, mysqli, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, Reflection, imap, shmop, SimpleXML, snmp, soap, sockets, exif, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, memcached, memcache, geoip, imagick, mysql, gd, ldap, mhash, ionCube Loader, Zend Guard Loader GD: Yes ImageMagick: Yes PHP max upload size: 100M PHP max form post size: 100M PHP memory limit: 128M Total max uploadable file size: 100M Resource folder writeable: Yes Session timeout: 240 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: Yes DOCUMENT_ROOT: /var/sites/w/ GATEWAY_INTERFACE: CGI/1.1 HTTPS: On HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8 HTTP_ACCEPT_ENCODING: gzip, deflate, br HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.9 HTTP_CONNECTION: close HTTP_COOKIE: _ga=GA1.3.708888084.1540900909; cmsa=1; _gid=GA1.3.1193281611.1547458682; PHPSESSID=03f2e21d2924936f13787c864bea1761 HTTP_HOST: HTTP_REFERER: HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 HTTP_X_FORWARDED_FOR: HTTP_X_FORWARDED_PROTO: https HTTP_X_HTTPS: On HTTP_X_PORT: 443 PATH: /bin QUERY_STRING: extended REDIRECT_STATUS: 200 REMOTE_ADDR: REMOTE_PORT: REQUEST_METHOD: GET REQUEST_URI: /perch/core/settings/diagnostics/?extended SCRIPT_FILENAME: /var/sites/w/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php SERVER_ADDR: SERVER_ADMIN: SERVER_NAME: SERVER_PORT: 443 SERVER_PROTOCOL: HTTP/1.1 SERVER_SOFTWARE: Apache UNIQUE_ID: XD8kjgqqAPUAAGavxIcAAAAX PHP_SELF: /perch/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1547641998.68 REQUEST_TIME: 1547641998 argc: 1