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

Getting related pages working with typhoon theme

Solved by david View solution

Started by david 4 years ago · 2 replies · 271 views
4 years ago

hi

premium theme typhoon comes with related pages plugin and in twig it is already set but i have for example under /home (blog) many centos post types but on post page "Other Related Posts" is not shown

post.html.twig

TWIG
{% if config.plugins.relatedpages.enabled and related_pages|length > 0 %}
        <h4 class="text-xl font-bold mt-4">Other Related Posts:</h4>
        <div class="flex flex-wrap -mx-4">
          {% for related_path, score in related_pages|slice(0,2) %}
            {% set related = grav['pages'].get(related_path) %}
            {% if related %}
              {% include "partials/post-item.html.twig" with {page: related} %}
            {% endif %}
          {% endfor %}
        </div>
      {% endif %}

relatedpages.yaml

YAML
enabled: true
limit: 5
show_score: true
score_threshold: 20
filter:
  items:
    '@page':
      - /blog
      - /home
  excluded_types:
    - quote
    - video
  order:
    by: date
    dir: desc
page_in_filter: true
explicit_pages:
  process: true
  score: 100
taxonomy_match:
  taxonomy:
    - tag
  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: false
last edited 12/13/22 by david
4 years ago

is there such thing as pump in year 2022 😄

4 years ago Solution

I found out that yaml file structure for some reason when created from gui does not work. This is mentioned also in here: https://github.com/getgrav/grav-plugin-relatedpages/issues/17

working relatedpages.yaml

YAML
enabled: true
limit: 5
show_score: true
score_threshold: 20
filter:
  items:
    @page: /home
  excluded_types:
    - quote
    - video
  order:
    by: date
    dir: desc
page_in_filter: true
explicit_pages:
  process: true
  score: 40
taxonomy_match:
  taxonomy:
    - tag
  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

Suggested topics

Topic Participants Replies Views Activity
Support · by Duc , 2 hours ago
1 17 1 hour ago
Support · by Thomas, 1 week ago
3 101 10 hours ago
Support · by Anna, 3 days ago
2 99 1 day ago
Support · by Justin Young, 1 day ago
1 66 1 day ago
Support · by Duc , 1 week ago
2 101 6 days ago