Archived
1
0
This repository has been archived on 2023-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
luminotes/model/delta/1.5.8.sql
Dan Helfman fc3849b8be HTML entities/characters like """ are now stripped from notebook names before turning them into friendly ids.
This means that blog posts now have better URLs if they the post titles contain HTML entities/characters.
2008-11-21 14:07:23 -08:00

16 lines
410 B
SQL

CREATE OR REPLACE FUNCTION friendly_id(text) RETURNS text
AS $_$select trim( both '-' from
regexp_replace(
regexp_replace(
regexp_replace(
lower( $1 ),
'&[a-zA-Z]+;|&#\\d+;', ' ', 'g'
),
'\\s+', '-', 'g'
),
'[^a-zA-Z0-9\\-]', '', 'g'
)
);$_$
LANGUAGE sql IMMUTABLE;
reindex index notebook_friendly_id_index;