2

Trying to create a page link to entries and can't figure out how to do it. Here's what I have. It's just outputting the title, but not the url. Specifically, I'm talking about {{ block.pageLink.first }} Any help is much appreciated.

{% for block in entry.threeHomepageImages.type('images') %}
    <div class="col">
        <div class="image-block">
            <div class="image">
                {% if block.image|length %}
                    <a href="{{ block.pageLink.first }}">
                        <img src="images/{{ block.image.first }}.jpg" alt="{{ block.alt }}">
                    </a>
                {% endif %}
            </div>
        </div>

        <h1><a href="#">{{ block.imageTitle }}</a></h1>

    </div>
{% endfor %}
2
  • I assume 'threeHomepageImages' is the Matrix field and 'image' is an Assets field? What type of field is 'pageLink'?
    – Brad Bell
    Commented Sep 17, 2014 at 18:00
  • It's an Entries field...
    – frshjb373
    Commented Sep 17, 2014 at 18:27

1 Answer 1

4

If pageLink is an Entry field and image is an Assets field, then you're probably looking for something like this:

<a href="{{ block.pageLink.first().getUrl() }}">
    <img src="{{ block.image.first().getUrl() }}" alt="{{ block.alt }}">
</a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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