getgrav / grav-plugin-relatedpages

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

scores, limit and current page ignored by plugin ? #23

Open JohnMica opened 5 years ago

JohnMica commented 5 years ago

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

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:

These are the issues:

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
JohnMica commented 5 years ago

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 ) screenshot 2018-11-10 at 20 15 31

items is null (items variable from related pages)

screenshot 2018-11-10 at 20 16 33

related_items does have items screenshot 2018-11-10 at 20 18 13

01Kuzma commented 4 years ago

Have you resolved this issue?

simogeo commented 2 years ago

same issue here with deliver theme, any clue ?