slug

How can I access django admin's transliterator for slugs when using fixtures?

In the admin, if you enter in a slug two things are applied through JS: The string is made slug-friendly The string is transliterated if the language is not English, so for example Cyrillic Russian text gets converted into Transliterated Russian ( typed out in English ) I'm basically inserting a couple thousand rows and I need to acc...

URL Slugs: Redirects or 404s?

Some sites, like here at SO, allow 'bogus' slugs in the URL. Before implementing URL slugs on my site, I have a question of 'best practices'... Given a structure like example.com/123/article-slug-here/, if my site allows bogus slugs by querying on the ID - Should I ... just do a redirect to the appropriate/canonical URL (verifyi...

Can a table have multiple slugs in Doctrine?

Is it possible to have multiple slugs on one table in Doctrine? I tried this in my yaml-file: Article: tableName: tst_article actAs: Sluggable: unique: true fields: [title] canUpdate: true Sluggable: unique: true fields: [text] name: secondSlug columns: id: type: integ...

Some questions about slugs in ASP.NET MVC content system

In my application I'm currently using forms which allow to enter Title and Slug fields. Now I've been struggling with the slugs thing for a while because I can never decide once and for all how to handle them. 1) Make Title and Slug indenpendent Should I allow users to enter both Title and Slug separetely? This is what I had first. I a...

best way to escape and create a slug

hey guys im somehow confused in using proper functions to escape and create a slug i used this : $slug_title = mysql_real_escape_string()($mtitle); but someone told me not to use it and use urlencode() which one is better for slugs and security as i can see in SO , it inserts - between words : http://stackoverflow.com/question...

ID + Slug name in URL in Rails (like in StackOverflow)

Hey, I'm trying to achieve URLs like this in Rails: http://localhost/posts/1234/post-slug-name with both ID and slug name instead of either http://localhost/posts/1234 or http://localhost/posts/post-slug-name (right now I have just slug name in URL, so this part is over). How can I do this? UPD I found an article on this: htt...

Problem in displaying a URL slug with dash

Hey guys I made a slug with dash for my stories URLs such as: http://stackoverflow.com/questions/482636/fetching-records-with-slug-instead-of-id This is my code to create slug : function Slugit($title) { $title = strip_tags($title); // Preserve escaped octets. $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1--...

IntegrityError at /maps/create/ (1062, "Duplicate entry '' for key 'slug'")

my form is : class MapForm(forms.ModelForm): slug = forms.SlugField(max_length=20) and did you know why? and how to make this running.. ...

Sinatra Title Slugs

I'm trying to create a slug helper in Sinatra. Here's the code (as seen here): helpers do def sluggify(title) accents = { ['á','à','â','ä','ã'] => 'a', ['Ã','Ä','Â','À'] => 'A', ['é','è','ê','ë'] => 'e', ['Ë','É','È','Ê'] => 'E', ['í','ì','î','ï'] => 'i', ['Î','Ì'] => 'I', ['ó','ò','ô','ö','õ'] => 'o', ...

How to convert super- or subscript to normal text in C#

I'm writing a slug generator for making nice urls. I'd like to convert m² to m2, but in a generic way that does this for all superscript (or subscript), not just a simple replace statement. Any ideas? ...

how wordpress can un-slug a title

i still , don't understand , how wordpress can understand what is this url refer to : www.mysite.com/about-me/ they are using no identifier if they using slug functions so how they can retain story information or in other word , how they change back the slugged title to select from database ...

Periods in Django's SlugField

Question Why can data loaded via the initial_data.yaml fixture populate a SlugField with a slug containing a period and not generate an error? Code Here's an excerpt of the model: class Project(models.Model): slug_code = models.SlugField(max_length=15) Here's the applicable initial_data.yaml excerpt: - model: myapp.project ...

drupal: standard way for creating a slug from a string

Hi there, A slug on this context is a string that its safe to use as an identifier, on urls or css. For example, if you have this string: I'd like to eat at McRunchies! Its slug would be: i-d-like-to-eat-at-mcrunchies I want to know whether there's a standard way of building such strings on Drupal (or php functions available from ...

Reduce Heroku Compiled Slug Size

I've just updated rails to v2.3.6 on my app under a bamboo-ree-1.8.7 stack and the compiled slug size has grown up to 40.5Mb! Previous to that last git push, the slug size was about 20Mb and was using rails v2.3.5. Is it because my slug has both of rails versions installed? Probably I'm missing something but I haven't added any special ...

URL Slugify alrogithm in C#?

So I have searched and browsed through the slug tag on SO and only found two compelling solution: Slugify and Character Transliteration in C# How to convert super- or subscript to normal text in C# Which are but partial solution to the problem. I could manually code this up myself but I'm surprised that there isn't already a solution...

Trying to figure out URL dispatcher for sluggale URLs like stackoverflow

I'm using the Tornado framework (Python). I have the sluggable URLs working. But I have 3 different entries in the URL dispatcher. I was wondering if someone could help me transform it into one line. This is what I have: (r"/post/([0-9]+)/[a-zA-Z0-9\-]+", SpotHandler), (r"/post/([0-9]+)/", SpotHandler), (r"/post/([0-9]+)", SpotHan...

Creating Slugs from Titles?

I have everything in place to create slugs from titles, but there is one issue. My RegEx replaces spaces with hyphens. But when a user types "Hi     there" (multiple spaces) the slug ends up as "Hi-----there". When really it should be "Hi-there". Should I create the regular expression so that it only replaces a space when there is a cha...

What is the most mature way/lib to generate SEO friendly URLs (slugs)?

I am looking for the most mature library, algorithm or code snippet that can generate SEO friendly and meaningful URLs from titles (e.g. www.example.org/what-is-the-most-mature-way-to-generate-seo-friendly-urls-slugs). I know one can easily write a 10-line function that does this but I am searching for a mature library that is able to h...

T-SQL function for generating slugs?

Hi All, Quick check to see if anyone has or knows of a T-SQL function capable of generating slugs from a given nvarchar input. i.e; "Hello World" > "hello-world" "This is a test" > "this-is-a-test" I have a C# function that I normally use for these purposes, but in this case I have a large amount of data to parse and turn into s...

Need a simple Regular Expression

Hi Guys I don't understand Regular Expressions that well. I need an expression that will only accept: numbers normal letters (no special characters) - spaces are not allowed either. Example: The regular expression should match: this-is-quite-alright It should not match this -is/not,soålright ...