File tree Expand file tree Collapse file tree 9 files changed +115
-15
lines changed Expand file tree Collapse file tree 9 files changed +115
-15
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ---
Original file line number Diff line number Diff line change
1
+ < form class ="pa4 black-80 "
2
+ action ='{{ with .GetPage "/search" }}{{.Permalink}}{{end}} ' method ="get ">
3
+ < fieldset class ="cf bn ma0 pa0 ">
4
+ < div class ="cf ">
5
+ < label for ="search-input " class ="f6 b db mb2 "> Búsqueda</ label >
6
+ < input type ="text " class ="f6 f5-l input-reset bn fl black-80 bg-white pa3 lh-solid w-100 w-75-m w-80-l br2-ns br--left-ns " id ="search-input " name ="query " placeholder ="Palabras a buscar ">
7
+ < input type ="submit " class ="f6 f5-l button-reset fl pv3 tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-25-m w-20-l br2-ns br--right-ns " value ="Buscar ">
8
+ </ div >
9
+ </ fieldset >
10
+ </ form >
Original file line number Diff line number Diff line change
1
+ < script >
2
+ window . store = {
3
+ { { range where . Site . Pages "Section" "posts" } }
4
+ "{{ .Permalink }}" : {
5
+ "title" : "{{ .Title }}" ,
6
+ "tags" : [ { { range . Params . Tags } } "{{ . }}" , { { end } } ] ,
7
+ "content" : { { . Content | plainify } } ,
8
+ "url" : "{{ .Permalink }}"
9
+ } ,
10
+ { { end } }
11
+ }
12
+ </ script >
13
+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.9/lunr.min.js " integrity ="sha512-4xUl/d6D6THrAnXAwGajXkoWaeMNwEKK4iNfq5DotEbLPAfk6FSxSP3ydNxqDgCw1c/0Z1Jg6L8h2j+++9BZmg== " crossorigin ="anonymous " referrerpolicy ="no-referrer "> </ script >
14
+ < script src ="/js/search.js "> </ script >
Original file line number Diff line number Diff line change
1
+ {{ define "header" }}{{ partial "page-header.html" . }}{{ end }}
2
+ {{ define "main" }}
3
+ < article class ="flex-l flex-wrap justify-between mw8 center ph3 ">
4
+ < header class ="mt4 w-100 ">
5
+ < h1 class ="f1 "> Búsqueda</ h1 >
6
+ </ header >
7
+ < div class ="nested-copy-line-height lh-copy f4 nested-links nested-img {{ $.Param "text_color " | default "mid-gray" }}">
8
+ {{ partial "search-form.html" . }}
9
+ < ul id ="results ">
10
+ < li >
11
+ Escribe palabras clave arriba para buscar este sitio.
12
+ </ li >
13
+ </ ul >
14
+ </ div >
15
+ </ article >
16
+ {{ partial "search-index.html" . }}
17
+ {{ end }}
Original file line number Diff line number Diff line change @@ -25,3 +25,9 @@ header.bg-top h2 {
25
25
color : white;
26
26
opacity : 0.8 ;
27
27
}
28
+
29
+ .sticky {
30
+ position : -webkit-sticky;
31
+ position : sticky;
32
+ top : 0 ;
33
+ }
Original file line number Diff line number Diff line change
1
+ const idx = lunr ( function ( ) {
2
+ this . ref ( "id" ) ;
3
+ this . field ( "title" , { boost : 15 } ) ;
4
+ this . field ( "tags" ) ;
5
+ this . field ( "content" , { boost : 10 } ) ;
6
+
7
+ for ( const key in window . store ) {
8
+ this . add ( {
9
+ id : key ,
10
+ title : window . store [ key ] . title ,
11
+ tags : window . store [ key ] . category ,
12
+ content : window . store [ key ] . content ,
13
+ } ) ;
14
+ }
15
+ } ) ;
16
+
17
+ ( ( ) => {
18
+ const params = new URLSearchParams ( window . location . search ) ;
19
+ const query = params . get ( "query" ) ;
20
+ if ( ! query ) {
21
+ return ;
22
+ }
23
+ const results = idx . search ( query ) ;
24
+ const searchResults = document . getElementById ( "results" ) ;
25
+
26
+ if ( results . length ) {
27
+ let resultList = "" ;
28
+ for ( const n in results ) {
29
+ const item = store [ results [ n ] . ref ] ;
30
+ resultList +=
31
+ '<li><p><a href="' + item . url + '">' + item . title + "</a></p>" ;
32
+ resultList += "<p>" + item . content . substring ( 0 , 150 ) + "...</p></li>" ;
33
+ }
34
+ searchResults . innerHTML = resultList ;
35
+ } else {
36
+ searchResults . innerHTML = "No se encontraron resultados." ;
37
+ }
38
+ } ) ( ) ;
Original file line number Diff line number Diff line change 16
16
</ aside >
17
17
{{ partial "social-share.html" . }}
18
18
< p class ="tracked p0 mb0 ">
19
- {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
20
- {{ if not .Date.IsZero }}
21
- < time class ="f6 dib tracked " {{ printf `datetime ="%s "` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}>
22
- {{- .Date.Format (default "January 2, 2006" .Site.Params.date_format) -}}
23
- </ time >
24
- {{end}}
25
- {{ with .Params.author | default .Site.Params.author }}
26
- Por < strong >
27
- {{ if reflect.IsSlice . }}
28
- {{ delimit . ", " | markdownify }}
29
- {{else}}
30
- {{ . | markdownify }}
31
- {{ end }}
32
- </ strong >
33
- {{ end }}
19
+ {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}
20
+ {{ if not .Date.IsZero }}
21
+ < time class ="f6 dib tracked " {{ printf `datetime ="%s "` (.Date.Format "2006-01-02T15:04:05Z07:00") | safeHTMLAttr }}>
22
+ {{- .Date.Format (default "January 2, 2006" .Site.Params.date_format) -}}
23
+ </ time >
24
+ {{end}}
25
+ {{ with .Params.author | default .Site.Params.author }}
26
+ Por < strong >
27
+ {{ if reflect.IsSlice . }}
28
+ {{ delimit . ", " | markdownify }}
29
+ {{else}}
30
+ {{ . | markdownify }}
31
+ {{ end }}
32
+ </ strong >
33
+ {{ end }}
34
34
</ p >
35
35
< h1 class ="f2 pv2 mv1 ">
36
36
{{- .Title -}}
Original file line number Diff line number Diff line change 14
14
</ div >
15
15
</ header >
16
16
{{ end }}
17
+ < header class ="bg-black-90 sticky w-100 ph3 pv3 pv4-ns ph4-m ph5-l ">
18
+ < nav class ="f6 fw6 ttu tracked ">
19
+ < a class ="link dim white dib mr3 " href ="{{ relURL "/" }}" title="Inicio"> Inicio</ a >
20
+ < a class ="link dim white dib mr3 " href ="{{ relURL "/search/" }}" title="Búsqueda"> Búsqueda</ a >
21
+ < a class ="link dim white dib " href ="https://omegaup.org/ " title ="Acerca de "> Acerca de</ a >
22
+ </ nav >
23
+ </ header >
Original file line number Diff line number Diff line change @@ -33,3 +33,9 @@ <h2 class="fw1 f5 f3-l white-80 measure-wide-l center lh-copy mt3 mb4">
33
33
</ div >
34
34
</ header >
35
35
{{ end }}
36
+ < header class ="bg-black-90 sticky w-100 ph3 pv3 pv4-ns ph4-m ph5-l ">
37
+ < nav class ="f6 fw6 ttu tracked w-70-ns center ">
38
+ < a class ="link dim white dib mr3 " href ="{{ relURL "/search/" }}" title="Búsqueda"> Búsqueda</ a >
39
+ < a class ="link dim white dib " href ="https://omegaup.org/ " title ="Acerca de "> Acerca de</ a >
40
+ </ nav >
41
+ </ header >
You can’t perform that action at this time.
0 commit comments