Skip to main content
7 votes

Best practice for channels and structures

You basically have two options for creating a "listing" or "archive" view for your Channel or Structure sections. The first option is to create a Single. This is in many cases appropriate, e.g. if ...
Mats Mikkel Rummelhoff's user avatar
6 votes

Channel not showing all items?

Set a limit of nulll on your entry query which means no limit. If you do not specify a limit, you will only see 100 entries. .limit(null)
Vaughn D. Taylor's user avatar
5 votes
Accepted

How to output first segment title/channel name of entry?

Unless I'm misunderstanding, it should be as simple as: {{ entry.section.name }}
Mike Pierce's user avatar
4 votes
Accepted

Can two sites use the same channel, but have unique entries?

There is a light switch field in your section settings with the label "propagate entries across all sites". Just turn it off and your entries will be unique
Robin Schambach's user avatar
4 votes
Accepted

GraphQL: get prev / next entry from current entry (channel)

You should be able to use next and prev (see documentation and this issue). query getEntryData($id: [QueryArgument]) { entry(id: $id) { id, slug, title, uri, prev(section: "...
Oli's user avatar
  • 7,495
3 votes
Accepted

List entries without specific tag

You could try something like following reducing the tagged entries into IDs that you then filter against (see this thread): {% set tag = craft.tags.search('All-Stars').first() %} {% set allEntries = ...
Cole Henley's user avatar
  • 1,741
3 votes

Display X number of characters from an entry

You can use the Twig slice filter do do this, e.g.: entry.text |slice(0, 100) If you want something that looks a little nicer, and you're using the SEOmatic plugin, you can use the ...
andrew.welch's user avatar
  • 11.6k
3 votes
Accepted

Linking to channel page

Create a single section that displays the channel entries so that I can link to it? Are you trying to select the actual Channel itself? (like the News / Blog). Trevor Davis' handy Listing Section ...
RitterKnight's user avatar
  • 6,582
3 votes
Accepted

Create a channel programmatically

When trying to figure out how to do something the core does programmatically, a good place to start is the core itself. In particular, you want to look at Craft's controllers which handle all ...
MoritzLost's user avatar
  • 11.3k
3 votes

How can i disable channel list url?

Craft doesn't have any default routes for the frontend. So if you're seeing anything else than a 404 page on your /services route, it's because you've put something there. The routing documentation ...
MoritzLost's user avatar
  • 11.3k
3 votes
Accepted

Directory-like page structure for many categories and cities

You should be able to use dynamic routes to do exactly what you want. Create a new route in the config/routes.php and point it to a twig template. return [ // Route /en/category/city to a template ...
Max Strebel's user avatar
2 votes
Accepted

Restricting relationship field by author

Brad is correct – this isn't possible to do without writing a plugin. For your particular use case, this will be very simple, though. What you'll have to do, is to write a custom FieldType that ...
Mats Mikkel Rummelhoff's user avatar
2 votes

Restricting relationship field by author

Craft's permission system doesn't go down to the field level, which is what you're looking for. You'd either have to replicate the functionality you're looking for on the front-end of the site, or ...
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

How to use the same category group as a filter on multiple channel sections?

I would use a dynamic route instead of the path and template assigned in the category group. If you want the urls to be /Steve/B and /Bob/B, the route would look like {tag}/{slug}. Then in the ...
Marion Newlevant's user avatar
2 votes

Case sensitive Channel urls problem

This is a server-side configuration issue, not a Craft issue.
andrew.welch's user avatar
  • 11.6k
2 votes

Linking to channel page

Any Section Type I.e. Single, Structure or Channel should be selectable via the Entries custom field. For example if you had two Sevtions: Article Call to action If you've already created the ...
Matt P's user avatar
  • 1,538
2 votes

How should I organize/structure my channel sections?

Some of this depends on what the content is for each item. If all these pages are essentially the same sort of thing, but they differ in how you're categorising them - it's just one channel, and you ...
Matt Wilcox's user avatar
  • 3,199
2 votes
Accepted

Channel Section with individual entry template and index templates?

The way I've done this in previously is in your templates have a directory titled Resources and inside that directory another directory titled _types Within the _types directory I will have the code ...
Tad Ward's user avatar
  • 317
2 votes
Accepted

Querying channel entries hits memory limit

Read some pages in the craft docs that Brad linked to get to know the basic structure where to place your files Go to Pluginfactory and create a plugin, you only have to check the "Variables" light ...
Robin Schambach's user avatar
2 votes

Querying channel entries hits memory limit

Assuming you're referring to Craft 2, the EntryModels that get returned to a template do have a significant memory overhead attached to them you're probably running into. Doing the math, even bumping ...
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

Same content on different slugs

Because your Entry URI is setup as my-channel/{slug} , When you go to my-channel/post-slug-1 Craft automatically sets the variable 'entry' to the entry post-slug-1. You don't need to loop through the ...
Chattervast's user avatar
2 votes
Accepted

Setting a default entry for the entry field

Entry fields do not natively support setting a default entry, but you can use the Globals section to achieve the same effect. Create a 'Default Call to Action Entry' field in your globals, and set ...
Jamie Wade's user avatar
  • 3,644
2 votes
Accepted

Using Conditionals in Title Format

The title field supports ternary syntax conditionals. You could do that like this: {firstName} {middleName|length ? middleName ~ ' '}{lastName} That says "if middleName has length, print it out, and ...
darylknight's user avatar
  • 3,290
2 votes
Accepted

How to show nothing when you leave an input field empty in the entries instead of showing an error?

Make sure to add an if statement to check if the value exist or not with the length filter for example. {% if entry.videoPhoto50 | length %} <img src="{{ entry.videoPhoto50 ..... .... {% ...
Christopher Dosin's user avatar
2 votes
Accepted

Relationship between channels/entries

It’s important to understand that using relations fields in the template works similar to using craft.entries. They return a element query object, for example entry.plantEntity in your entries loop. ...
carlcs's user avatar
  • 36.2k
2 votes

Channgel entry to disabled

Under Settings > Sections > [section] > Site Settings, you can set the Default Status per-site for new entries in that section. For copying the actual content, set the appropriate "Propagation Method"...
James Smith's user avatar
  • 5,189
2 votes
Accepted

Dates for entries are in different language

If you go to that user's account settings, then click on the "Preferences" tab, I'm guessing they have their "Formatting Locale" setting set to Cymraeg.
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

Set a default Channel page if no slug is provided in the URL

Assigning the current entry is not the best approach, as this will mean the same page is served for /skills and /skills/technology - this is bad for SEO. Instead, you can redirect with the redirect ...
MoritzLost's user avatar
  • 11.3k
1 vote

How to handle search results that point to a page of aggregated entries?

I guess I'll answer my own question. Use a conditional in search results and overwrite the value of the entry's URL: {% if getSection() == 'mySection' %} {% set entry.url = '/mySectionUrl' %} {% ...
4midori's user avatar
  • 656
1 vote

Using Conditionals in Title Format

Can you use the join filter in these fields? If so, something like this may be a little cleaner: {{ [object.firstName, object.middleName, object.lastName] | join(' ') }}
Trevor Davis's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible