Forum

Thread tagged as: Question, Runway

Adding view page / preview link to a collections article edit page

With articles in a collection, is it possible to add a view page / preview link to the article edit page by generating a custom URL?

Adam Green

Adam Green 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's not currently. At the moment you only get a link if the item is in draft. The same happens with Blog. It's an oversight, and we're looking to correct it in a future update.

Thanks Drew, that would be brilliant if one could include a custom URL field for the preview link, i.e. mydomain.com/article-preview/article-slug.

I tried generating a link from the article slug in the with the perch:help tag but nothing gets output.

I can't see a link when the item is in draft - where would I find this?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You should get a preview button in both the listing and at the top of the edit page. You'll need to make sure you've set the single-item URL in the region/collection options.

Aha thanks, didn't realise I needed to set the single item URL! The preview link in draft is working now, though the article is still showing up when I list the article using perch_collection:

   perch_collection('Articles', [
      'template'   =>'article-category-list.html',
      'category' => $category_slug,
      'sort'       =>'date',
      'sort-order' =>'DESC',
   ]); 

Is there a way to filter out articles that are in draft from the listing?

Drew McLellan

Drew McLellan 2638 points
Perch Support

The draft is of the next revision of that item. It isn't a show/hide flag.

Of course, thanks! I've added a 'Publish' checkbox as the show/hide flag and filtered the output to list only published articles.

Drew, Just a quick follow up as to find out when we might expect a collections preview link / button in the non draft items? Many thanks!

Rachel Andrew

Rachel Andrew 394 points
Perch Support

It's on the list, we don't have a fixed date.