FAQ Database Discussion Community


Slugfield URL implementation in Django

django,slug
So, I am having some difficulty trying to slugify a title field in my model and still have it return the proper information. Currently, a user can follow the url, if the list in their account exists under this regular expression: url(r'^user/(?P<username>\w+)/list/(?P<listname>\w+)/$', mylistpage, name='lists'), The issue I face is that...

Link ID in wordpress url

php,wordpress,permalinks,slug
Currently I am working on a wordpress website, but I stumbled upon a little problem. I am using wp_page_menu to make a navbar to get to my other pages. Now it directs me to www.mysite.com/sport, but I need it to direct me to www.mysite.com/sport#header or www.mysite.com/sport/#header. Does anyone know how...

How to create slugs in arabic characters in Django?

python,django,unicode,slug
I am wondering how to make slugs out of Arabic/Persian strings in django? What I am trying to achieve is to create slugs like: این-یک-تیتر-است out of این یک تیتر است That is, all spaces, commas and parentheses need to be converted to hyphens....

How to add a slug to username for Devise?

ruby-on-rails,ruby,devise,slug
Usually, I create slugs like this: params[:user][:name_slug] = params[:user][:name].parameterize But this quite problem with Devise - how can I add it? I've created a controller where I specified attributes that are needed for creating a user, but how to add the slug there? class RegistrationsController < Devise::RegistrationsController private def sign_up_params...

Build a slug with multiple fields

slug,bolt-cms
Normaly I use slug: type: slug uses: title to define the slug in a Bolt contenttype. But now I would like to define it more like this: slug: type: slug uses: date+title How can this be done? What is the syntax to be used?...

Is it possible in laravel 5 to show a pretty url to the user, and a practical url to the app?

routing,routes,laravel-5,friendly-url,slug
I have this url: mywebsite.com/user/1/edit I want my users to see this: mywebsite.com/edit-your-profile/ Is this possible when using Route::resource('user', 'UserController');? If yes, how do I do it :) ? I still want my app to be able to see user/1/edit as I use it in my middleware to prevent unauthorized...

Is there a way to create duplicated subcategory slugs on Wordpress?

php,wordpress,category,slug
I've googled around for this like crazy, but can't seem to find a not too outdated answer for this question or something that actually works. My problem is just like the one this guy describes on this forum post (from 4, holy FOUR years ago!): https://wordpress.org/support/topic/duplicate-subcategory-slug-problem I'm currently using the...

How to link to another user in Django template

django,templates,hyperlink,model,slug
I want to link to another user to show for example their public activities. But I don't know how to link it via template. This is my user profile model: class UserProfile(models.Model): user = models.OneToOneField(User) name = models.CharField(max_length=64) location = models.CharField(max_length=64, default='Tehran') picture = models.ImageField(upload_to='profile_images', blank=True, default="/user_image/user_default.png") slug = models.SlugField()...

web.com/post/post-title redirects to web.com/post-title

wordpress,url,permalinks,slug
I'm having a complain of the SEO guy because a post url is not like this web.com/blog/post-title But like this web.com/post-title And even web.com/blog/post-title redirects to web.com/post-title How could I restore normal behavior? it looks like they are being treated as page but they work as posts in web.com/blog...

Using slugs in laravel 5?

laravel-5,slug
I have made eloquent-sluggable work on my app. Slugs are saved just fine. Buuuut... How do I use it to create a pretty url? If possible, I would like to use them in my url instead of ID numbers....

Completely remove separators using slugify

php,slug,separator,slugify
I am using slugify to generate the users slug but I want to remove dashes, dots, spaces and every type character that would be considered a separator.

Retrieving the Slug from URL for function (Laravel 5)

php,eloquent,laravel-5,blade,slug
I'm making an App where a group is created by a user. This user can go to the group page (automated unique slug is created for the groups). My goal is for the member who created the group, to be able to make a invite code for that specific group....

Redirect url if slug does not match

django,redirect,slug
I want to use the same url model as SO. The lookup is done through the id number but if the wrong slug is in the link than a redirect is thrown to the correct page. example: questions/4787731/whatever will redirect to questions/4787731/canonical-links-and-301-redirect-if-url-doesnt-match-slug. My current code does the lookup through the...

Trigger Slug with symfony

symfony2,doctrine,slug
I am working with Symfony, and I am trying to slug some element of my database using Doctrine's extension Gedmo. The issue is that I initialize my database with a sql script, so I dont trigger the generation of the slug by Doctrine. I would like to know if there...

Category slug in article URL (ManyToManyField)

django,url,categories,slug,manytomanyfield
I am trying to build a URL pattern such as /category/article/ but the problem is, one article can be related to many categories, so the URL should be something like /category+category/article/ What I have: models.py from django.db import models from django.core.urlresolvers import reverse class Category(models.Model): name = models.CharField(max_length=128, unique=True) slug...

why I got the error “Couldn't find article with id=ni-hao-wo-zhen-de-henhaoma” when using stringex?

ruby-on-rails,slug
I want to use stringex for more friendly url. Now my steps as follows: (1) In the model called article: acts_as_url :title, :url_attribute => :slug def to_param slug end (2) articles#show: def show debugger show! do |format| format.html # show.html.erb format.json { render json: @article } end end (3) the...

Generate a friendly urls using UTF-8 encoding in javascript [closed]

javascript,php,url,generator,slug
I am trying to make friendly url from title. I find out many solutions but it has still problem with unicode character. eg: 'xin chào' in vietnamese I saw https://sluggenerator.com/ was OK. Could anyone helps me to do like this by javascript. Thanks in advance!...

get() missing 1 required positional argument: 'args', Django slug RedirectView

python,django,get,slug
I want to redirect a a view so that it shows the title and the id_number but I get the error in the title. Models: from django.db import models from django.core.urlresolvers import reverse from autoslug import AutoSlugField class EntitiesNew(models.Model): id = models.CharField(max_length=20, blank=True) description = models.CharField(max_length=500, blank=True) title = models.CharField(max_length=500,...

How to use Yii2 Sluggable Behavior?

php,url,routing,yii2,slug
I have defined this behavior as per documentation instructions. public function behaviors() { return [ TimestampBehavior::className(), [ 'class' => SluggableBehavior::className(), 'attribute' => 'title', ], ]; } In my config url manager I have defined custom rule like this: example.com/article/1 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' =>...