Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent CMS page provider from leaking placeholder code #73

Open
borjadevelop opened this issue Feb 22, 2019 · 4 comments
Open

Prevent CMS page provider from leaking placeholder code #73

borjadevelop opened this issue Feb 22, 2019 · 4 comments

Comments

@borjadevelop
Copy link

Hi
I need some help, because in the search on CMS pages the result provider give me all the text in the page, including including js.
I had to force the js code in the page it return when search.
It has happened to someone or someone has some idea of ​​how to fix it
Some photos
Same result for .text
image
result.
image

Thanks!!

@tobias-kuendig
Copy link
Member

What's the content of your cms page? As described in the README support for CMS pages is very experimental. The twig contentes will not be rendered and displayed 1:1 in the search results.

It's always safer to use static pages or pull the contents out into a separate plugin.

@borjadevelop
Copy link
Author

`title = "Homepage"
url = "/"
layout = "default"
is_hidden = 0

[siteSearchInclude]

{% if not(slider.slides.slideShows is same as ('no_slider')) %}
{% put scripts %}

<script> $(document).ready(function(){ var args = { accessibility: {{numberToBoolean(slider.slides.slideShows.accessibility)}}, autoplay: {{numberToBoolean(slider.slides.slideShows.autoplay)}}, autoplaySpeed: {{ slider.slides.slideShows.autoplay_speed ?: 3000 }}, arrows: {{numberToBoolean(slider.slides.slideShows.arrows)}}, prevArrow: '{{ slider.slides.slideShows.prev_arrow ? slider.slides.slideShows.prev_arrow|raw : '' }}',` It can be because its the first text on the htm???

@tobias-kuendig
Copy link
Member

This won't work. You can only use the CMS provider if you have plain HTML code on the page.

Components on CMS pages will not be rendered. Use this provider only for simple html pages. All Twig syntax will be stripped out to prevent the leaking of source code to the search results.

I'm leaving this issue open since we might be able to at least prevent the leaking JavaScript code but at the moment you're best off just removing the [siteSearchInclude] component. If you want to make the "slides" searchable use a custom search provider as described in the README.

@borjadevelop
Copy link
Author

Okay thanks. I think what I'm going to do is remove the line of text and only return the title of the page

Thanks you!

@tobias-kuendig tobias-kuendig changed the title CMS page returns code Prevent CMS page provider from leaking placeholder code Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants