grav-plugin-relatedpages
grav-plugin-relatedpages copied to clipboard
scores, limit and current page ignored by plugin ?
Hi guys,
Not sure if this is an issue per say or not, but I've been trying to achieve some magical things with Grav and this plugin and I ran into a huge wall.
The problem is
I have 3 blog pages on the same site
- blog named 'istoria-canabisului'
- blog named 'marturii'
- blog named 'recurse-medicale'
Trying to use the plugin to only display the 'related' articles based on the parent page ( one of the blogs above )
I managed to get them semi working as in:
- related posts only from the current blog (awesome)
These are the issues:
- the limit is not working so I get all posts from current blog
- the current page is being displayed as a link in the related pages
- no score is present for any of the related pages results
Am I doing something fundamentally wrong in trying to achieve this ?
The article has
{% set collection = page.parent.children %}
{% include 'partials/sidebar-article.html.twig' with {
base_url: page.parent.url,
related_pages: collection,
} %}
My sidebar has
{% if config.plugins.relatedpages.enabled and related_pages | length > 0 %}
<div class="sidebar-content">
<p class='subtitle'>{{ 'SIDEBAR.RELATED_POSTS.HEADLINE'|t }}</p>
{% include 'partials/relatedpages.html.twig' with {
related_pages : related_pages
} %}
</div>
{% endif %}
the plugin has
enabled: true
limit: 5
show_score: true
score_threshold: 25
filter:
items:
'@page':
- istoria-canabisului
- marturii
- resurse-medicale
order:
by: date
dir: desc
page_in_filter: false
explicit_pages:
process: true
score: 75
taxonomy_match:
taxonomy:
- category
# - tag - tried with tag only but same results apply
taxonomy_taxonomy:
process: true
score_scale:
1: '50'
2: '75'
3: '100'
taxonomy_content:
process: true
score_scale:
1: '20'
2: '30'
3: '45'
4: '60'
5: '70'
6: '80'
7: '90'
8: '100'
content_match:
process: true
and trying to dump all variables I get this (as per the images below)
and please ignore my typos inside the dump command - just wanted something to see
relatedpages.html.twig has
{% for slug, page_folder,
items in related_pages %}
{% set related = grav['pages'].get(page_folder.path) %}
{% if related %}
{{ dump('slug',slug, 'page fodler',page_folder,'related_pages',related_pages,'items', related_pages[items], 'relatesd', related,'score',score) }}
page folder has the following ( no items )
items is null (items variable from related pages)
related_items does have items
Have you resolved this issue?
same issue here with deliver theme, any clue ?