Questions tagged [slug]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
24
votes
4answers
8k views

Add home page to a structure?

I am using a structure for all of my site's pages (single pages and channel index pages). The structure settings are as follows: URL for Top-Level Entries: {slug} URL for Nested Entries: {parent.uri}...
13
votes
1answer
7k views

Get category title by slug

I'm setting my categories by matching the third segment to a category slug. How do I get the category title? {% set catSlug = craft.request.getSegment(3) %} {% set category = craft.categories.slug(...
9
votes
2answers
4k views

How would I include the first category slug in the section's entry URL format?

I have a custom section that uses routes like this: /section/category/entry_url In trying to program the search form results I realized that I need to explicitly define the entry URL format for the ...
5
votes
1answer
884 views

How to add year and month to Entry URL Format

I'd like to make the Entry URL format of a channel look like this: /news/2015/06/my-slug-here What would I need to enter into the Entry URL Format field in order to do this? The closest I could ...
4
votes
1answer
258 views

Should I pluralize a channel's index slug?

Lets say I have a channel called places, which has the following URL : http://example.com/places The url points to a directory of individual places. However, when you click into an entry, each ...
4
votes
2answers
679 views

Can I use translated properties for URL formats

Here's my scenario. I have a structure section: "events". Within that I have three entry types: "events", "exhibitions", "specials". I would like the events to follow the following URL structure: {...
4
votes
2answers
827 views

How to transform German umlauts when creating slugs?

First of all, I want to thank you for creating Craft. It's really one of the best content management systems I have ever worked with. I encountered an issue while working on a multilingual site: ...
3
votes
1answer
652 views

Error: URI already taken

I've got a content type for team members but whenever I try to add one it gives me an error saying "the URI 'team' has already been taken". I assume the URI is made from the slug, which is where I ...
3
votes
1answer
143 views

Is it possible to use Craft as a webservice when no useragent is sent?

We're setting up craft as a webservice. One of my programmers came to me and said every "slug" he called from the frontend application resulted in a 302 redirect to the login page of craft CP. Afer ...
3
votes
1answer
2k views

How do I create an advanced route with multiple slugs?

I'm trying to create a route for an RSS feed which allows for the following routes. domain/feed domain/category/feed domain/category/subcategory/feed I have the first two routes working and the ...
3
votes
3answers
373 views

Trouble with transliteration in slug caused by hardcoded charmap in craft.js

I've been struggling with automatic slug generation in Czech language: there are letters such as "š" or "č" and Craft has a charactere map hardcoded in craft/app/resources/js/craft.js, resp. craft/app/...
3
votes
1answer
125 views

.relatedTo() not returning tags with spaces

I think I'm seeing a bug while using advanced search with relatedTo(). If I use a simple search, like this: {% set param = { order: 'RAND()', limit: null, search: "#{request.tags}" } %} It ...
3
votes
1answer
2k views

Is it possible to add an entry value to the entry URL Format?

I try to compose an entry URL for artists pages with first name and last name. Now: artists/{slug} = artists/{{ entry.title }} {slug} = {{ entry.title }} = Artist Last Name What I want to add at ...
3
votes
2answers
3k views

Get content of single by slug

I'm trying to get the content of a single using a slug from the url. I'm using the following code: {% set item = craft.entries.slug(craft.request.getSegment(1)).first() %} This doesn't work, returns ...
3
votes
1answer
471 views

Auto generation of localised slug

When an entry is created and saved in a locale the corresponding entry is created for other locales using the original title. However, when the title of the locale which needs translating is edited ...
3
votes
1answer
440 views

Include related entry slug in URl

I've got a channel named "locations" that has an entry fieldtype which allows me to select the corresponding store/brand (limited to 1). How can I define the slug of the related entry in Entry URL ...
3
votes
1answer
543 views

Category slug is getting numbers appended to it

I have a category Australia and have been experimenting with boboldehampsink import plugin. After deleting categories and starting over the category Australia now has a slug called 'australia-6'. I ...
3
votes
1answer
1k views

Using { slug } to create subfolders won't work

I'm running craft locally using MAMP and I'm trying to move assets into a subfolder when unploaded into an image field in my gallery section. I'm trying to set the path to subfolder so it uses the ...
2
votes
1answer
1k views

Nginx Vhost Config - Get page based on translated URI and without parameters in url [duplicate]

I have a localized site, localization works fine for homepage (/en/), however the links to other page does not work (/en/rooms) where /chambres works fine for default language. The English 'chambres' ...
2
votes
1answer
62 views

Use of duplicate slugs, without -1

Is there a way/workaround for using "duplicate" slugs? Example: shop.com/candy (category page with listing of candy's) shop.com/about-us/candy (plain page with info about the production process etc)...
2
votes
2answers
724 views

Multiple URL Formats per element type (Entries, Categories)

I suspect this boils down to a feature request, but I'll start here in case there are any other ideas. Basically, I want to be able to define multiple URL formats for a single section or category ...
2
votes
1answer
208 views

Entry slug auto appends -1 even when the original slug is unique

I have an entry slug like this: cics-west-belden-1 the -1 seems to be auto appended to the slug, but there are no other entries with the project cics-west-belden in my project. When I remove the -1 ...
2
votes
1answer
1k views

Multilingual slug setup

I'm setting up my first multilingual website with Craft. I'm struggling with multilingual slugs. This is how I'd like the slugs to look like. If I do this tough, I need to adapt my folder structure. ...
2
votes
1answer
413 views

Can't rename slug

Each time I try to rename a slug within an entry, the page refreshes, but the slug is getting a -1 appended. The slug I want is: forms. The slug I get after saving is: forms-1. I've checked through ...
2
votes
1answer
884 views

Querying database for slug match?

Does anyone know how to query the database to find entry data based on a slug? The only table field I see that contains slug data is in craft_entryversions.data in json format. Anyone ever tried ...
2
votes
1answer
93 views

How to set index page as parent of a structure

I don't know if it's possible, but what I would like is to have a structure with 3 levels linked to a single entry that would act as the index. The problem is the examples I've seen are only with 1 ...
2
votes
1answer
165 views

Matrix Field Slug Output

I am not sure why, but I cannot seem to get the short name/handle/slug of a matrix field that is a category field. I need to get it's slug. {% for row in entry.matrixField %} {{ row.matrixChild....
2
votes
1answer
53 views

Receive all used slugs

I want to create a Excel file with all used slugs in my Craft website. I've searched for a plugin but without succes. I also tried to find a useful table in the Craft database, also without succes. ...
2
votes
1answer
314 views

Can I use a structure without slugs?

I'm making a portfolio website, where the url's look like "projects/project-name". There is also an overview page with all the projects that is under "projects" on itself. I'm using a Structure for ...
2
votes
1answer
1k views

Twig: Show specific entry by url

my url looks like this: domain.tld/slug-1/slug-2/variable And in Twig it shall look for an entry with the slug slug-1 and show it, then an entry with the slug slug-2 and show it and look up for a ...
2
votes
1answer
461 views

Setting an entry slug from a pluign

I have a plugin where I'm creating custom entries based on user submitted data. Saving these entries works well. As does modifying their titles after saving to add the entry's ID to the title (using ...
2
votes
1answer
213 views

Insert action in front of template, while maintaining entry slug

We are attempting to implement a number of Pardot forms within Craft templates. Since Pardot's form actions do not allow us to dynamically specify a return URL, our best choice is to use the form's ...
2
votes
1answer
1k views

Auto generating slug with custom fields or ID

I'm not sure I've seen this exact question, but I'm curious how I can include custom and/or auto-generated parts of a slug. It's not the URI creation, but the slug itself. For Instance: {slug}-{id} ...
2
votes
1answer
431 views

Best solution for articles tag page?

I've been looking through the forum, it seems there's a few methods to retrieve a tags page but I'm looking for the most efficient method (both speed- and template-wise). Using tag.name with tag ...
1
vote
3answers
1k views

How to change an entry's slug on EVENT_AFTER_SAVE_ELEMENT?

My entries' titles are auto-generated from several fields values on first save. When one of these fields values change, I would like to update the auto-generated slug also: Event::on( \craft\...
1
vote
2answers
390 views

How to remove something from the slug/url

I got entries in the folder /cms/web/videos/ and the url display this: http://domainname.com/cms/web/videos/barco-auro. I want it to be this: http://domainname.com/videos/barco-auro. How do I create ...
1
vote
1answer
214 views

Getting only slug in otherwise null object on routed template

I'm trying to create a template route that allows me to get all of the attorneys that I've related to a specified practice area. I can get the slug easily, as my route looks like this: 'attorneys/...
1
vote
1answer
675 views

How to Generate Unique Slugs for a Section without ticking "Entries in this section have their own URLs"

I am working on a site that has an events calendar with Future, Current and Expired events being shown. Which is completely fine when I am on the index page and have "Entries in this section have ...
1
vote
2answers
143 views

Advanced routing

I am trying to do this. Have a structure url like so: /{id}-{slug} and /{parent.id}/{id}-{slug} I need the slug on the url but I only for SEO, I want craft to ignore the slug and only go for the ID. ...
1
vote
1answer
268 views

Bulk regenerate slugs

I’ve already got a ton of content put in by the client, and there’s quite a bit of accented characters (é, à, ...) in the titles, and thus also in the slugs where they get url encoded, which my client ...
1
vote
1answer
808 views

customised slugs using custom field

I have a 'Profile' channel that gives the profile of people. I have 'Last name' as the title, 'first name' and I'd like to use first name in the slug rather than have to add the first name to the ...
1
vote
1answer
4k views

How to filter entries by slug in url segment?

I want to return entries in the news section, except the one that has a slug the matches url segment 2. I've tried: {% for entry in craft.entries.section('news').slug(not craft.request.getSegment(2))...
1
vote
1answer
39 views

Special Characters in Slugs

I need to output a slug that will include characters like < and |. I realise that these can't be literal, so I had hoped to be able to swap them out for the URL encoded equivalents. For example, ...
1
vote
1answer
30 views

nested sections

how can i achieve the following result? i have a structured section called products like /hardware/apple/iPhone which gets the template /templates/productpage.twig now i need need to load a different ...
1
vote
1answer
69 views

Allowing duplicate slugs in category paths

Again, I've had a look online but couldn't figure out what I had to do. Say I've got a category structure like the below: Category 1 Saturday Sunday Category 2 Saturday Sunday How can I allow ...
1
vote
1answer
82 views

Same content on different slugs

I hope someone can help me to understand this. I have a Channel called eg. "My channel". In that channel i have two entries: Post 1 and Post 2. Those two entries have different titles and content. ...
1
vote
1answer
122 views

Channel entry: Slug from field pattern?

I have defined an entry for a channel, let's say of persons, to have some fields, let's say firstname, lastname and bio, but no title. When I created the first real entry, craft complained it had no ...
1
vote
1answer
63 views

call matrix entries

I set up a form structure with a matrix. Now I would like to call the entries one by one. My first idea was to loop through them, but the outcome is that the entries are displayed alltogether. Then ...
1
vote
2answers
307 views

How to point a static url to a file

I have a field "menu card" in my globals' section "menuCard", so I could access my file in the template with menuCard.menuCard.first().url. That is fine, but when the editor changes the menu-card file ...
1
vote
1answer
363 views

Dynamic Subfolder Paths - folder does not exist even after updating asset directories in settings

I have an asset directory which is set to {basePath}assets/images/products/ I know my basePath is right as it works on other asset sources. My entry upload location for products is set to: {slug}/...