Better location scheme parameter

It’s not a complicated enhancement, but I thought I’d share it.

The following Generic location scheme parameter under the Site Folder Assembly context creates pages named in the format “SystemTitle.html” instead of the FF default “page1234.html”.

if ($sys.crossSiteLink) {$prefix = $;} else {$prefix = $sys.variables.rxs_urlroot;} $prefix + $sys.pub_path + $sys.template.prefix + $sys.item.getProperty('rx:sys_title').String + $rx.location.getFirstDefined($sys.item,'rx:activeimg_ext,rx:sys_suffix', '.html')

This way, content creators can choose their own file names, and they can be semantically-relevant, search-engine-friendly file names.

Other enhancements: force the file names to be all lower-case.

I personally want Category Pages (main page in each folder) to be named “index.html” but I haven’t taken the time to figure out how that would work with location schemes or dispatch templates.

Hi Michael

One issue with this approach is that content items can have punctuation in the title which you dont want to display in the filename eg ? &


I agree with James, the problem with this approach is the characters that end users can put in the sys_title, but should not be part of the actual filename when published (think of &, <, >, space, etc).

We have gotten around this problem by validating sys_title as described on the following post:

Incidentally, using regexp would also be the way to force the end users to only enter lower case in the sys_title. Also do note, that if you do implement it, this also affects folder names.

Excellent. That was the initial post that showed me it was possible, but I had forgotten some of the details. I’ll add those validation rules.

We frequently recommend that people use the sys_pathname field for this, rather than overload the system title. You will, of course, need to validate that it is unique.

Here are a couple of useful location schemes from Tech Support:

Publish - generic:
$sys.pub_path + $sys.template.prefix + $sys.item.getProperty(‘rx:sys_title’).String + $rx.location.getFirstDefined($sys.item,‘rx:activeimg_ext,rx:sys_suffix’, ‘.html’)

Site Folder Assembly - generic:

if ($sys.crossSiteLink) {$prefix = $;} else {$prefix = $sys.variables.rxs_urlroot;} $prefix + $sys.pub_path + $sys.template.prefix + $sys.item.getProperty(‘rx:sys_title’).String+ $rx.location.getFirstDefined($sys.item,‘rx:activeimg_ext,rx:sys_suffix’, ‘.html’)

Here is an example that may help you do what you are looking for:

$sys.pub_path + $sys.item.getProperty(‘rx:sys_contentid’).getString() + “-” + $sys.item.getProperty(‘rx:sys_title’).getString().replaceAll(’ ‘, ‘-’).replaceAll(’&’, ‘_’).toLowerCase().trim() + “.html”

With toLowerCase, that would force the filenames to be lowercase, correct? Any suggestions on a location scheme that would name Landing Pages as index.html, as discussed in ? Tech Support suggested creating a Landing Page content type, but I’d rather be able to change filenames on the fly.

With a lot of help, I’ve now got a working index.suffix location scheme that takes landing pages into account. When you get your syntax wrong on these things, every page gets named yoursite.war, and it took a while to figure out what I was doing wrong.