slug

php/regex: "linkify" blog titles

I'm trying to write a simple PHP function that can take a string like Topic: Some stuff, Maybe some more, it's my stuff? and return topic-some-stuff-maybe-some-more-its-my-stuff As such: lowercase remove all non-alphanumeric non-space characters replace all spaces (or groups of spaces) with hyphens Can I do this with a single reg...

Change wordpress gallery shortcode slug to filename

Is it possible to change the attachment page slug to the referring filename? In short... i use the Gallery Shortcode to build a simple page based gallery. I change the orignal filename (like DSC1223.jpg) during the upload process (to 3b1871561aab.jpg) but it does not appery as slug within the url. It uses only DSC1223. Is there anyway ...

Symfony and Doctrine: sluggable behaviour: field called "slug" is not created

I have this model: Usuario: actAs: Sluggable: unique: true fields: [nombre_apellidos] canUpdate: true inheritance: extends: sfGuardUser type: simple columns: username: type: string(128) notnull: false unique: true nombre_apellidos: string(60) sexo: boolean...

How do you remove invalid characters when creating a friendly url (ie how do you create a slug) ?

Say I have this webpage: http://ww.xyz.com/Product.aspx?CategoryId=1 If the name of CategoryId=1 is "Dogs" I would like to convert the URL into something like this: http://ww.xyz.com/Products/Dogs The problem is if the category name contains foreign (or invalid for a url) characters. If the name of CategoryId=2 is "Göra äldre", what sh...

Using slugs in codeigniter

I have heard of people using slugs for generating clean urls. I have no idea how it works. Currently i have a codeigniter site which generates url's like this www.site.com/index.php/blog/view/7 From what i understand by maintaining a slug field it is possible to achieve urls like www.site.com/index.php/blog/view/once-upon-a-time Ho...

Django: autoslug -> custom slugifier

Hello Experts. I have a prob. I'm trying to create a custom slugify functiom. I use django.autoslug. Due to autoslug documentation I was able to create a custom slugifier, but it needs to be improved and I do not know how do I realize that. So I have a string (book title) i.e. .NET Framework 4.0 with C# & VB in VisualStudio 2010. I want...

Strange behaviour of slugify function

It works perfectly from the admin site. But the code below doesn't work properly(some characters are missing, like Turkish "ı") in some languages. class Foo(models.Model): name = models.CharField(max_length=50, unique=True, db_index=True) slug = models.SlugField(max_length=100, unique=True, db_index=True) def save(self, *ar...

Auto update sluggable field with Doctrine

Hello everyone, I'm using CodeIgniter with Doctrine in a project. One of my models has the Sluggable behavior. The slug is created according to another field X when the object is saved. I was wondering if there was a way to automatically update this slug field when the X field is updated. At the moment, if I update the X field, the slu...

Are extended ASCII chars [äöå] allowed in URLs?

I have seen some websites that use äöå-characters in their slugs (they don't convert them to aoo). So what's the case? ...

Do encoded URLs have better SEO than slugs?

I can't think of an example, but hopefully you get the idea. Encoded URLs have some characters replaced with those weird %20% type of codes (so I think none of the original characters/meaning is lost) whereas slugs have all the special characters stripped off and white spaces replaced usually with dashes or plus sign ('-' or '+'). ...

Django: better to save a slug to the DB or generate dynamically, if used for lookup?

So this is almost a duplicate of this question, except that I do want to use the slug for lookup. My URLs look like this: http://url.com/county/place-name The unique combination of 'county' and 'place-name' is used to look up the database object, except that 'place-name' is stored in the database as 'Place Name'. So if I don't stor...

django utf-8 normalization

Greetings I want to slugify/normalize utf8 string however I get # -*- coding: utf-8 -*- from django.template.defaultfilters import slugify print slugify( unicode("şşşşüüüüççç") ) and get result as "ssssuuuccc", however I get UnicodeDecodeError 'ascii' codec cant decode ... error. ...

how to "un-slug" a title slug

Hi I'm creating a system which requires a slug system. For example, the URL for a blog post entitled "The Blog Title: Here" would be: YYYY/MM/DD/the-blog-title-here I have the system pretty well set up, where if your URL matches more than one entry it displays summaries of all matched entries, and if it only matches one entry it displ...

How to use the I8n behaviour in combination with sluggable behaviour in Doctrine

Hi, i've got a table with articles. The table has the fields id, title and text. I'm using the sluggable behaviour on the title-field resulting in a unique url $sluggable0 = new Doctrine_Template_Sluggable( array('name'=>'url', 'fields'=>array(0 => 'title'), 'unique'=>true, 'canU...

How to create a unique slug in Django

I am trying to create a unique slug in Django so that I can access a post via a url like this: http://www.mysite.com/buy-a-new-bike_Boston-MA-02111_2 The relevant models: class ZipCode(models.Model): zipcode = models.CharField(max_length=5) city = models.CharField(max_length=64) statecode = models.CharField(max_length=32) ...

how to make url slug like Quora does using yi framework ?

Using Quora has made me wonder how they do their slug like thes : quora.com/topics-slugs , quora.com/questions-slug or quora.com/usernames-slug. Actually i am developing an application with yii framework and i want to have a slugs like quora does? Thanks guys ...

Unique slugs that, if fits with slug-1, slug-2... slug-n

I am using only slug to identify a page on the website, like: example.tld/view/this-fancy-slug . This is generated from the title automatically with this function: public static function Normalize($str) { $charset = "UTF-8"; $separator = "-"; $str = strtolower(htmlentities($str, ENT_COMPAT, $charset)); $str = preg_repla...

Implementing URL slug functionality in a website

I would like to know how to implement a URL slug functionality in a website, without having the ID of the record currently being viewed show up in the URL. For example, StackOverflow URLs look like this: http://stackoverflow.com/questions/3099232/mvc-dynamic-views-from-url-slug. Notice the URL contains the ID of the record. If I were to...

stubs, dynamic homepage in cakePHP

Hey everyone. I'm working on a site for a client that wants to be able to update modifying their content. The brief was to allow them to edit pages, but not create or delete them. For the site I decided to work with cakePHP, as I've heard good things. First up, a quick explanation of my setup. I've got a single table, called 'contents'...