SiteSearch

Adds global search capabilities to October CMS

Back to SiteSearch Support

RedEclipse
RedEclipse

Hi, I'm using Rianlab Blog plugin and at this moment I trying to achieve search work properly with category in the path. i have following properties in path of blog post "url = "/portal/:portal-category/:slug".

But problem is, when I trying to search it return result with non-exited category "default" such as /portal/default/welcome instead of /portal/news/welcome. Can you please tell me how to fix this?

Thanks

OFFLINE
OFFLINE

The plugin won't handle theses cases by default. You can overwrite the content.htm partial and do something like this (untested and you will have to modify it)

...
<p class="ss-result__url">
    {% if result.identifier == "RainLab.Blog" %}
        {% set url = {{ 'your-blog-page' | page({slug: result.model.slug, 'portal-category': result.model.category.slug}) }} %}
    {% else %}
        {% set url = {{ result.url | app }} %}
    {% endif %}
    <a href="{{ url }}" class="ss-result__link">{{ __SELF__.visitPageMessage }} &rarr;</a>
</p>
RedEclipse
RedEclipse

Thanks for swift reply,

I tried your code, but unfortunately cannot deal with this error(tried few variations with braces,commas but failed) I'm quite new to this. {% set url = {{ 'your-blog-page' | page({slug: result.model.slug, 'portal-category': result.model.category.slug}) }} %}

CMS returns "A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{"."

Can you tell me what's problem with it?

UPD:

I slightly modified it, no more errors but it still returns "default" instead of category name {% if result.identifier == "RainLab.Blog" %} {% set url = 'portal-post' | page ({slug: result.model.slug, 'portal-category': result.model.category.slug}) %} {% else %} {% set url = result.url | app %} {% endif %} <a href="{{ url }}" class="ss-result__link">{{ __SELF__.visitPageMessage }} &rarr;</a>

Last updated

1-3 of 3