We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Blog

Blog Post_in_list link to lightbox / External link

Is there a way to make a blog article in "Post_in_list.html" link to an external link or a Lightbox?

Basically I want to make a certain blog postings open a Lightbox Video instead of going to a separate page. Ideally I would like to do this with "Post Types" so users could select the Post Type was a Video.html rather that a post.html

James Tedder

James Tedder 0 points

  • 6 months ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello James,

Conditional tags can be helpful here: https://docs.grabaperch.com/templates/conditionals/

If you have a field called video that you only populate if the post is a video, you can conditionally output different things to the page:

<perch:if exists="video">
<!--* output the post in the list as video *-->
<perch:else>
<!--* output the post in the list as a regular post *-->
</perch:if>

If you're using post types, you can test against postTemplate:

<perch:if id="postTemplate" match="eq" value="video.html">
<!--* output the post in the list as video *-->
<perch:else>
<!--* output the post in the list as a regular post *-->
</perch:if>

Thanks for the reply. I have tried it with one of my non-video templates first.

I have tried the postTemplate option above and it doesn't seem to work. It just misses any post.

I cant seem to find any documentation on the use of postTemplate either?

This is my post_in_list.html file

<perch:before>
<div id="mygallery">
</perch:before>


    <a href="<perch:blog id="postURL" />" class="folio-listing">
        <perch:if id="postTemplate" match="eq" value="slideshow_post.html">
            <img src="<perch:repeater id="horizontalslides" label="Project gallery" max="1" ><perch:blog type="image" id="image" label="Slide image" height="800"></perch:repeater>" />
    <perch:else>
        <img src="<perch:blog id="image" type="image" height="800"  />" alt="<perch:blog id="postTitle" />" />

    </perch:if>
        <div class="folio-listing-text">
            <div class="row">
                <div class="col">
                <h4><perch:blog id="postTitle" /></h4>
                </div>
            </div>
            <div class="row">
                <div class="col">
                <p><perch:blog id="excerpt" type="textarea" textile="true" words="20" /></p>
                </div>
            </div>
        </div>
    </a>



<perch:after>
</div><!-- END MOSCAIC -->
</perch:after>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the value of postTemplate in <perch:showall>?

ah that helped. It needed to be

<perch:if id="postTemplate" match="eq" value="posts/slideshowpost.html">

Thanks guys :-)