Project

General

Profile

Actions

Feature #14536

closed

Configurable word sep char for SimulateStaticDocuments

Added by Georg Rehfeld almost 20 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Target version:
-
Start date:
2005-02-07
Due date:
% Done:

0%

Estimated time:
PHP Version:
4
Tags:
Complexity:
Sprint Focus:

Description

There was a request to make the underscore used by SimulateStaticDocuments for separation configurable. Especially changing it to a dash will make Google recognize it as a word separation character. Also multiple consecutive occurrences should be reduced to just one, optionally.

The patch provided introduces 2 new TS config values:
config.simulateStaticDocuments_substChar, string, 'The character to use for substitution of non alphanumeric characters. Be carefully with this to not mess up generated urls, the char is used unchecked, just as is. Default: _ (underscore)'
config.simulateStaticDocuments_substConsecutive, boolean, 'Wether multiple consecutive occurrences of the substitution character should be reduced to just one. Default: false'

The patch is under test on one site and seems to work there.

See request thread at http://typo3.org/documentation/mailing-lists/dev-list-archive/thread/110108464/?tx_maillisttofaq_pi1%5Bmode%5D=1
(issue imported from #M759)


Files

0000759-class.tslib_fe.php.diff (1.19 KB) 0000759-class.tslib_fe.php.diff Administrator Admin, 2005-02-07 21:48
0000759-class.tslib_fe.php.diff (1.19 KB) 0000759-class.tslib_fe.php.diff Administrator Admin, 2005-02-08 06:16
Actions #1

Updated by Georg Rehfeld almost 20 years ago

After some testing I enhanced the code to allow for an empty substChar and a setting, which characters to preserve. The updated docs:

config.simulateStaticDocuments_substChar
- Datatype: string
- Description: The character(s) to use for substitution of non alphanumeric characters. Be carefully with this, to not mess up generated urls, the chars are used unchecked, just as they are. Note, that a string of more than one character is accepted al well and substituted in. Usually you will just want to set it to '-' (a single hyphen), also set the ....substConsecutive to true and the ....substPreserve to empty. You can remove the default char by setting this to an empty value like so:
- Sample: config.simulateStaticDocuments_substChar =
- Default: _ (one underscore)

config.simulateStaticDocuments_substPreserve
- Datatype: string
- Description: Characters to preserve additionally to alphanumeric ones. There ain't too much choices, usually only '_' (underscore) and '-' (hyphen). Important to note: if you want to preserve the '-' (hyphen), then be sure to list it LAST in this string, as it actually is used as the last part of a regular expression pattern. Failure to NOT listing hyphen last might give you strange results. Note also, you can't preserve the substitution character. You may clear the default as described under simulateStaticDocuments_substChar by just setting ...._substPreserve to empty.
- Default: _- (underscore and Hyphen)

config.simulateStaticDocuments_substConsecutive
- Datatype: boolean
- Description: Wether multiple consecutive occurrences of the substitution character/string should be reduced to just one.
- Default: false

The patch (submitted next) is built to change the previous behaviour as little as possible, so if you don't use any of the config.simulateStaticDocuments_subst* settings, your generated URLs will seldom differ from before applying the patch. Only with titles longer than the number of chars given in config.simulateStaticDocuments_addTitle you might see a minor difference.

Also the patch will NEVER influence any link to your site existing around the world negatively (even, if the packets would have to travel 3 times around it :-) ): the generated string is purely cosmetic/aesthetic/human readable/search engine friendly and gets ignored all of the time when the URL is resolved by Typo3.

hth, Georg

Actions

Also available in: Atom PDF