Forum

Thread tagged as: Problem, Error, Docs

Problem with composite, slug and date - outputting random string

Hey folks,

I am trying to create a slug using title and date:

First in my template: <perch:content id="compositeslug" type="composite" for="title date_day date_month date_year" join="-" />

...which outputs something like "Title of Post-01-11-2016".

Then I try to generate the slug: <perch:content id="slug" for="compositeslug" type="slug" />

...but it is creating a random string as the slug, e.g. "ra-d41d-cd98"

Could you advise?

Diagnostics: Perch: 3.0.4, PHP: 5.6.30, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO Server OS: Darwin, cgi-fcgi Installed apps: content (3.0.4), assets (3.0.4), categories (3.0.4) App runtimes: <?php $apps_list = [ ]; PERCH_LOGINPATH: /perch PERCH_PATH: /Users/iamkeir/Sites/camotest/perch PERCH_CORE: /Users/iamkeir/Sites/camotest/perch/core PERCH_RESFILEPATH: /Users/iamkeir/Sites/camotest/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7 Resource folder writeable: No SCRIPT_NAME: /perch/core/settings/diagnostics/index.php REQUEST_URI: /perch/core/settings/diagnostics/ DOCUMENT_ROOT: /Users/iamkeir/Sites/camotest HTTP_HOST: localhost

Keir Moffatt

Keir Moffatt 0 points

  • 4 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

Use the full for tag in the slug id - like so:

<perch:content id="slug" for="title date_day date_month date_year" type="slug" />

Thanks Duncan, that seems to have worked - curious!