1

How can I be able to have a single section page (so that clients can't create another one of this) that only needs 1 index.html template across different languages AND be accessible through following different slugs:

  • x.dev/muziektoerisme
  • x.dev/fr/tourisme-musical/
  • x.dev/en/music-tourism/

I currently have a setup similar to this one: Add home page to a structure?, which is a structure section 'Pages' with my custom page entry type 'musictourism' under 'craft/templates/_pages/_types/' (so 'musictourism.html' sits in this folder) This works great, except for the fact that users are able to recreate a page of this entry type, which I don't want.

Does my question make any sense? Or am I missing something fundamental here? :) I'm new to Craft by the way.

Thanks in advance!

1

What you're asking for is fine. Create a subfolder within your public directory for each locale with it's own index.php and define the new path to craft/ and the locale. For example, within public_html/fr/index.php you might have:

// Path to your craft/ folder
$craftPath = '../../craft';

// Tell Craft to serve the FRENCH content
define('CRAFT_LOCALE', 'fr');

With the single, you set the slug yourself within the section's settings (one slug for each locale that section is available to).

| improve this answer | |
  • Hi, thank you for your reply! I had already configured the language folders, so that wasn't the issue :) I guess I forgot to configure the single's slug in multiple languages, like you mentioned in the last paragraph of your comment. Thanks! – mdmngz Mar 3 '17 at 13:28
  • Easy mistake to make. – Clive Portman Mar 3 '17 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.