Closed marwann closed 6 years ago
Hi, @marwann!
May it be that your issue is related to #28?
Hello @matiasgarciaisaia,
I missed that issue while searching, but that's indeed related. Good new is that after a good night's sleep, I found a solution after re-reading the doc.
All fields values are retrieved from the resource data (i.e. its frontmatter), or from the options in the resource.metadata (i.e. any options specified in a proxy page)
So the trick was just to add options in the proxy and then to add them to the index.
Here's some sample code for the proxy :
data.application.each do |f|
proxy "/categories/#{f['url']}/index.html", "landing_page.html", locals: {
data: {
url: f['url'],
title: f['title'],
description: f['description']
}
}, ignore: true, "title" => f['title'], "description" => f['description']
end
And sample code for the extension in config.rb
activate :search do |search|
search.resources = ['categories/', 'index.html']
search.index_path = 'search.json'
search.fields =
{
"title" => {boost: 100, store: true},
"description" => {boost: 100, store: true},
}
end
Awesome! 👌
So, I'm closing this - feel free to reply anyway if there's anything else.
This was super helpful - the above plus just a few syntax tweaks helped me to get this working. Much appreciated.
Hello,
I'm creating dynamic pages based on a yaml file :
Example
application.yml
Example
config.rb
As I understand, the data indexed for search are parsed in the dynamic pages Frontmatter, however, it is impossible to add variables like the following piece of code. So the result is that I either get a generic title/description for all my dynamic pages, or have them replaced by
null
inside the json file generated by Middleman-search.landing_page.html.erb
How should I proceed to ensure the data is still parsed by the extension?