Forum
Changing the blog post slug
I am new to perch so hitting some issues. I am converting a Wordpress blog over to Perch. In addition to the postTitle each posts have a "smalldesc" text field which may or may not be present. Now the slugs for each post is a combination of the post title and smalldesc field in Wordpress. I am trying to replicate that in runway.
I have added the below field after the postTitle in the template.
<perch:blog id="postSlug" type="slug" label="Post slug" size="xl autowidth" order="1" editable="true" suppress="true" />
Even though I make the field editable it automatically resets itself to postTitle because that is what the setting is. If I remove the {postTitle} setting it defaults to date-postTitle. I tried adding a custom slug field like
<perch:blog id="recipesPostSlug" type="slug" label="Post slug" size="xl autowidth" order="1" editable="true" suppress="true" />
and then in my template
perch_blog_custom(array(
'filter' => array(
array(
'filter' => 'recipesPostSlug',
'match' => 'eq',
'value' => perch_get('s'),
),
array(
'filter' => 'postSlug',
'match' => 'eq',
'value' => perch_get('s'),
),
),
'match' => 'or'
));
This works and I am able to see the posts in the custom slug. But it also shows up in the regular postSlug. I can live with that. However all other Page Functions like perch_blog_post_tags, perch_blog_post_meta etc. query directly on the postSlug.
I over the perch_blog_post_meta function in my template where it queries with my custom slug. However this feels to me as if I am duplicating each and every function.
Is there a way I can update the postSlug itself. That will reduce lots of code.
I am right now developing locally. I am on OSX and I am using MAMP.
Here is my diagnostic report:
Diagnostics report
PERCH INFORMATION
Perch Runway: 2.8.29
Production mode: Production (100)
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_blog (5.0)
DB driver: PDO
DB tables: YouAreMyEnjoyable1972_backup_plans (0), YouAreMyEnjoyable1972_backup_resources (0), YouAreMyEnjoyable1972_backup_runs (0), YouAreMyEnjoyable1972_blog_authors (2), YouAreMyEnjoyable1972_blog_comments (37), YouAreMyEnjoyable1972_blog_index (1803), YouAreMyEnjoyable1972_blog_posts (44), YouAreMyEnjoyable1972_blog_posts_to_tags (86), YouAreMyEnjoyable1972_blog_sections (2), YouAreMyEnjoyable1972_blog_tags (29), YouAreMyEnjoyable1972_blogs (1), YouAreMyEnjoyable1972_categories (25), YouAreMyEnjoyable1972_category_counts (22), YouAreMyEnjoyable1972_category_sets (4), YouAreMyEnjoyable1972_collection_index (0), YouAreMyEnjoyable1972_collection_items (0), YouAreMyEnjoyable1972_collection_revisions (0), YouAreMyEnjoyable1972_collections (0), YouAreMyEnjoyable1972_content_index (17), YouAreMyEnjoyable1972_content_items (5), YouAreMyEnjoyable1972_content_regions (4), YouAreMyEnjoyable1972_navigation (0), YouAreMyEnjoyable1972_navigation_pages (0), YouAreMyEnjoyable1972_page_routes (7), YouAreMyEnjoyable1972_page_templates (11), YouAreMyEnjoyable1972_pages (7), YouAreMyEnjoyable1972_resource_log (96), YouAreMyEnjoyable1972_resource_tags (0), YouAreMyEnjoyable1972_resources (99), YouAreMyEnjoyable1972_resources_to_tags (0), YouAreMyEnjoyable1972_settings (23), YouAreMyEnjoyable1972_user_passwords (0), YouAreMyEnjoyable1972_user_privileges (34), YouAreMyEnjoyable1972_user_role_privileges (16), YouAreMyEnjoyable1972_user_roles (2), YouAreMyEnjoyable1972_users (1)
Users: 1
App runtimes:
<?php
$apps_list = array(
'content',
'categories',
'perch_blog',
);
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup
H1: 2a7391ffc821d79de044e01593e8d036
L1: 99d960a83ae55d85cc8c4cb31958f43a
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #000000
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.29: done
headerScheme: dark
update_runway_2.8.29: done
latest_version: 2.8.15
on_sale_version: 2.8.29
perch_blog_site_name:
perch_blog_post_url: /recipes/{postSlug}
perch_blog_slug_format: {postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_blog_comment_notify: 0
perch_blog_update: 5.0.1
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch
PERCH_SCHEDULE_SECRET: rijoEsS4UlCViiOH
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: PuchkiDuchkiDoesNotCook
PERCH_DB_PREFIX: YouAreMyEnjoyable1972_
PERCH_EMAIL_FROM: boombooOm.gof@gmail.com
PERCH_EMAIL_FROM_NAME: Shubhojyoti Bhattacharya
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch/perch
PERCH_CORE: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch/perch/core
PERCH_RESFILEPATH: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: Asia/Kolkata
PERCH_DEBUG:
PERCH_RUNWAY: 1
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_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch/perch/templates
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.10
Zend: 2.6.0
OS: Darwin
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $
MySQL server: 5.5.42
Free disk space: 23.32 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, cgi-fcgi, imap, gettext, mcrypt, yaz, pgsql, pdo_pgsql
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PHP_FCGI_CHILDREN: 4
PWD: /Applications/MAMP/fcgi-bin
PHP_FCGI_MAX_REQUESTS: 200
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x0
ORIG_SCRIPT_NAME: /fcgi-bin/php5.6.10.fcgi
ORIG_PATH_TRANSLATED: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch/perch/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /perch/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php5.6.10.fcgi
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /perch/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 62805
SCRIPT_FILENAME: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch/perch/core/settings/diagnostics/index.php
SERVER_ADMIN: you@example.com
DOCUMENT_ROOT: /Users/shubhatt/Dropbox/Enjoyable Recipes/Perch
REMOTE_ADDR: ::1
SERVER_PORT: 80
SERVER_ADDR: ::1
SERVER_NAME: enjoyablerecipes.perch
SERVER_SOFTWARE: Apache
PATH: /usr/bin:/bin:/usr/sbin:/sbin
HTTP_COOKIE: cmsa=1; PHPSESSID=99b277a1ae360df4e5c34056345a9227
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_REFERER: https://enjoyablerecipes.perch/perch/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: keep-alive
HTTP_HOST: enjoyablerecipes.perch
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php-fastcgi
FCGI_ROLE: RESPONDER
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1466950603.54
REQUEST_TIME: 1466950603
argc: 1
There's a currently open bug about the
postSlug
changing when the post title changes. It should stay the same.Okay thanks for the confirmation. I am trying out some workarounds.