Search results displays jquery text

Created on 6 January 2024, 12 months ago
Updated 19 January 2024, 11 months ago

I have a website that I use the layout builder for some of it’s pages and content made with layout builder is not searchable with core Search. I use Search API, the included Database server, and Views to create a custom Search solution. It uses rendered item. Works OK.
Under Structure I have a Layer Slider that is included with my theme. The Problem: When the layer slider content is added to the layout builder, it will display the jquery in the search results. I don't know how to conceal the jquery from appearing. (see image).

💬 Support request
Status

Active

Version

1.31

Component

General code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sioux
  • 🇦🇹Austria drunken monkey Vienna, Austria

    Tricky problem. I have no real experience with this, and also no proper solution, sorry.
    Defining a new view mode specifically for indexing and configuring it in a way that excludes the layer slider might work – not sure if that’s feasible, though?
    Using the HTML Filter processor and setting “Tag boosts” to include script: 0 might also work, depending on your exact setup.
    Otherwise, I fear that it would be necessary to write some custom code to resolve this, maybe within Views. It would first be helpful to find out which component actually strips away the <script> tags – changing that behavior to instead remove the <script> elements entirely, together with their contents, seems like the adequate solution here. Or maybe overriding the Rendered Item processor to remove such elements from the start would also be an option. Anyways, don’t know whether writing custom code is an option for you.

  • Thank you for your suggestions, in my Views I do have 'strip html' selected on my fields under rewrite, and I added 'script: 0' to the Tag boosts. I have tried various configurations in Search API's processors without succeeding. Sadly, I do not know how to write a custom solution for this problem.

  • 🇺🇦Ukraine abramm Lutsk

    Hi sioux,

    What is the module used to build a slider? I've seen a 'revolution' method being called in your jQuery code so I suppose that's a revolution slider (but there are no D8/9/10 compatible modules at Drupal.org or I'm looking at the wrong place).

    It seems like the module generates inline script tags which doesn't sound right.
    Instead, I'd suggest moving slider instance settings to Drupal settings object and initializing instances with Drupal behavior JS.

Production build 0.71.5 2024