Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Best Practice

Started by Muut Archive 11 years ago · 24 replies · 641 views
11 years ago

Placing the dump is showing that all the YAML info is coming through as expected. I put <img src="{{ child.header.upcomingrace.image }}" /> in the code and got <img src="biloxi.jpg" />, which was expected. I am having issues figuring out what should surround {{ child.header.upcomingrace.image }}. On the taxonomy page I have working - {{ post.media[post.header.racer.image].url }} does the trick. I have tried all combinations, nothing seems to work.

11 years ago

Does the image file exist in the page? Try dumping post.media

11 years ago

the dent in my desk, where I am pounding my head from both frustration and "duh" moments is growing larger. Thanks for your help, once again.

11 years ago

rhukster, I came across a bug that I am having an issue finding solution for regarding the blog feed on the homepage. I am unsure where it's pulling the date from - seems maybe from the homepage date?

Ex: http://offshorepowerboatgp.com/

The code:

TWIG
<ul class="news">
    {% for press_item in page.find('/press').children.published.slice(0,4) %}
    <li>
        <h3><a href="{{ press_item.url }}">{{ press_item.title }}</a></h3>
        <p class="meta"><span class="list-blog-date">{{ page.date|date("F") }}, {{ page.date|date("d") }} {{ page.date|date("Y") }} </span></p>
    </li>
    {% endfor %}
</ul>

The meta data was pulled from the Blog item template.

11 years ago

Looks like your pulling the date form page.date so yes, it's the parent page. If you want the date from the item your looping over, you would need to use press_item.date.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1326 9 years ago
Archive · by Muut Archive, 9 years ago
2 920 9 years ago
Archive · by Muut Archive, 9 years ago
2 4050 9 years ago
Archive · by Muut Archive, 9 years ago
1 2928 9 years ago
Archive · by Muut Archive, 9 years ago
3 1107 9 years ago