getgrav / grav-plugin-relatedpages

Grav RelatedPages Plugin
http://getgrav.org
MIT License
17 stars 7 forks source link

changing the Related Posts #21

Open JOduMonT opened 6 years ago

JOduMonT commented 6 years ago

Hi; ;)

I was looking to change the mention Related Posts.

Prepared to make few modification into the html than referring the variable into the languages.yaml but ...

So I'm mesmerism and don't know or how i could potentially make this PR.
OK I'll give an example because I probably lost myself between few TAB and windows..

I would like

When I use this plugins on my blog
I would like to see theses theses articles might interest you
instead of Related Posts

It would be awesome if it was attach to a variable and than I just had to change the text inside languages.yaml

such as my blog is multilingual.

;)

danjames68 commented 2 years ago

This is a very late answer but it might help somebody else.

The plugin template only has the code to list the related pages, and this is wrapped in a code inside a theme's sidebar partial template.

    {% if config.plugins.relatedpages.enabled and related_pages|length > 0 %}
        <h4>Related Posts</h4>
        {% include 'partials/villa/relatedpages.html.twig' %}
    {% endif %}

To change the Related Posts title you could first substitute the text with {{ BLOG.SIDEBAR.RELATED_POSTS|t }} and then add your preferred option in each language in the language files.

I tend to have a languages folder and then have a file inside for each language - en.yaml - it.yaml etc.