2

I need some advise about the best way to achieve this.

My site is set up with a Channel called 'Product' for example.

I then have entries within this section

  • Product A
  • Product B
  • Product C

Only one of these products will be active at once.

All links on the site for 'Product' will need to link to the active product page (A, B or C).

The way I'm thinking of doing this is having a lightswitch on the Product pages to state which is the current (active) one.

I can't get my head around how this might work at the moment so any advise would be much appreciated.

2

I would create a single template that is displayed when you visit /product and set entry to be the first entry in the Product channel that is live.

{% set entry = craft.entries.section('products').status('live').first() %}

All you need to do then is disabled all product entries apart from the product you want to display.


UPDATE: To avoid duplicate content or different content on the /product page you could redirect to the current product entry page /products/product-a using

{% redirect entry.url %}

| improve this answer | |
  • This is a nice solution thanks. Only concern is you then have duplicate content at page /product and on the entry at /product/product-a for example – sarah3585 Jun 13 '16 at 10:57
  • To avoid that you could set the /products template to redirect to entry.url. {% redirect entry.url %} – Luke Pearce Jun 13 '16 at 11:10
  • Super! thank you. – sarah3585 Jun 13 '16 at 11:38

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.