getgrav / grav-theme-gateway

Gateway incorporates elegant style with user friendly customizer options making it perfectly suited for a variety of Grav users. With rock solid development and flexible integration, the Gateway theme is sure to be a favorite for first time Grav users and experienced developers alike.
https://getgrav.org
GNU General Public License v2.0
12 stars 9 forks source link

Featured article with link in excerpt displayed incorrectly #3

Closed xhs345 closed 8 years ago

xhs345 commented 8 years ago

Just a minor issue. If there is a link in an article that gets featured on the front-page and it contains a link then the link to the article will be displayed incorrectly (it's still working as expected).

See image below in the right side:

gateway-issue

flaviocopes commented 8 years ago

Can you paste an example of page content that could break http://demo.getgrav.org/gateway-skeleton/ ?

xhs345 commented 8 years ago

This would be the text from the article in the picture above:

As I noted in the Sydney post, the weather on my first week of arrival was quite [terrible](http://www.dailymail.co.uk/news/article-3627123/Sydney-s-wild-weather-Worst-storm-40-years-devastates-coastal-homes-1000-evacuated-entire-swimming-pool-collapses-ocean.html). Luckly I ...

Link is written as Markdown

flaviocopes commented 8 years ago

Yep it's a matter of how the blog post Twig is written.

It has

    {% elseif truncate and readmore is sameas(false) %}
    {{ page.content|truncate(200) }}
    {% elseif truncate and page.summary != page.content %}

so it cuts at 200 chars, not applying the global site.summary.size unless readmore is set to true.

You could edit this theme's modular.html.twig and set readmore: true

      {% include 'partials/blog_item.html.twig' with {'page':child, 'truncate':true, 'readmore': true} %}

so it removes the html link and puts a read more link at the bottom.

In general, themes are meant to be customized with inheritance https://learn.getgrav.org/themes/customization#theme-inheritance to suit your particular needs, so that's a route to follow, instead of editing the current theme to suit every need.

xhs345 commented 8 years ago

Ok, thanks for the info.

Since you closed this already I assume you're not interested in a fix. For anyone else finding this: I fixed it for me by using truncate(200, true), that way the last word (or in this case link) wont be cut off.

flaviocopes commented 8 years ago

@xhs345 if you post a PR I'll gladly merge it.

xhs345 commented 8 years ago

Ok, sure. PR open

flaviocopes commented 8 years ago

👍 thanks!