Skip to content

Commit 2637079

Browse files
authored
Merge pull request #3321 from EdwardNavarro/feature/search-spanish
Add search engine for Spanish version
2 parents 787248d + 33e2449 commit 2637079

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

gatsby-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const createSearchConfig = (indexName, language) => {
1616
letter
1717
part
1818
}
19-
id
19+
id
2020
rawMarkdownBody
2121
}
2222
}
@@ -43,6 +43,7 @@ const createSearchConfig = (indexName, language) => {
4343
const plugins = [
4444
createSearchConfig('finnish', 'fi'),
4545
createSearchConfig('english', 'en'),
46+
createSearchConfig('spanish', 'es'),
4647
createSearchConfig('chinese', 'zh'),
4748
createSearchConfig('portuguese', 'ptbr'),
4849
{

src/components/Navigation/Navigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const getNavigation = (language, t) => {
3737
};
3838

3939
const searchIsEnabledForLang = lang => {
40-
return ['fi', 'en', 'zh', 'ptbr'].includes(lang);
40+
return ['fi', 'en', 'es', 'zh', 'ptbr'].includes(lang);
4141
};
4242

4343
const handleCloseMenu = () =>

src/pages/search.es.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
import { graphql } from 'gatsby';
3+
4+
import SearchPage from '../components/SearchPage';
5+
6+
const Search = ({ data }) => (
7+
<SearchPage
8+
localSearch={data.localSearchSpanish}
9+
title="Buscar en el material"
10+
inputPlaceholder="Introduce un término de búsqueda"
11+
lang="es"
12+
/>
13+
);
14+
15+
export default Search;
16+
17+
export const pageQuery = graphql`
18+
query {
19+
localSearchSpanish {
20+
store
21+
index
22+
}
23+
}
24+
`;

0 commit comments

Comments
 (0)