mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-27 01:02:17 +00:00
additional search tweaks
This commit is contained in:
parent
9223c6ca9e
commit
6da286c017
5 changed files with 14 additions and 21 deletions
|
@ -5,6 +5,9 @@ function displayResults (results, store) {
|
||||||
for (const n in results) {
|
for (const n in results) {
|
||||||
const item = store[results[n].ref];
|
const item = store[results[n].ref];
|
||||||
resultList += '<li><a href="' + item.url + '">' + item.title + '</a></li>'
|
resultList += '<li><a href="' + item.url + '">' + item.title + '</a></li>'
|
||||||
|
if (item.description)
|
||||||
|
resultList += '<p>' + item.description + '</p>'
|
||||||
|
else
|
||||||
resultList += '<p>' + item.content.substring(0, 150) + '...</p>'
|
resultList += '<p>' + item.content.substring(0, 150) + '...</p>'
|
||||||
}
|
}
|
||||||
searchResults.innerHTML = resultList;
|
searchResults.innerHTML = resultList;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<form id="search"
|
<form id="search"
|
||||||
action='{{ with .GetPage "/search" }}{{ .Permalink }}{{ end }}' method="get">
|
action='{{ with .GetPage "/search" }}{{ .Permalink }}{{ end }}' method="get">
|
||||||
<input type="search" id="search-query" name="query" placeholder="Looking for something?" aria-label="search text">
|
<input type="input" id="search-query" name="query" placeholder="grep -i" aria-label="search text">
|
||||||
<button type="submit" aria-label="search button"><i class="fa-solid fa-magnifying-glass"></i></button>
|
<button type="submit" aria-label="search button"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||||
</form>
|
</form>
|
|
@ -5,6 +5,7 @@
|
||||||
"title": "{{ .Title }}",
|
"title": "{{ .Title }}",
|
||||||
"tags": [{{ range .Params.Tags }}"{{ . }}",{{ end }}],
|
"tags": [{{ range .Params.Tags }}"{{ . }}",{{ end }}],
|
||||||
"content": {{ .Content | plainify }},
|
"content": {{ .Content | plainify }},
|
||||||
|
"description": {{ .Description | plainify }},
|
||||||
"url": "{{ .Permalink }}"
|
"url": "{{ .Permalink }}"
|
||||||
},
|
},
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{ partial "search-form.html" . }}
|
{{ partial "search-form.html" . }}
|
||||||
|
<br>
|
||||||
<ul id="results">
|
<ul id="results">
|
||||||
<li>
|
<li>
|
||||||
Enter a keyword above to search this site.
|
Enter a keyword above to search this site.
|
||||||
|
|
|
@ -223,42 +223,31 @@ form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
margin: 0.25rem;
|
outline: 0.25rem solid var(--bg);
|
||||||
height: 1.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
flex-grow: 2;
|
flex-grow: 2;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: var(--off-bg);
|
background-color: var(--off-bg);
|
||||||
/* border-radius: 0.25rem; */
|
|
||||||
color: var(--off-fg);
|
color: var(--off-fg);
|
||||||
|
height: 1.5rem;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
font-family: var(--font-monospace);
|
||||||
}
|
}
|
||||||
|
|
||||||
input:focus {
|
input:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:placeholder-shown {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
form:focus-within {
|
form:focus-within {
|
||||||
outline: 1px solid var(--logo);
|
outline: 1px solid var(--logo);
|
||||||
/* border-radius: 0.25rem; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* form input {
|
|
||||||
border-radius: 0.25rem;
|
|
||||||
margin: 0.25rem;
|
|
||||||
background-color: var(--off-bg);
|
|
||||||
} */
|
|
||||||
|
|
||||||
form button {
|
form button {
|
||||||
/* border-radius: 0.25rem;
|
|
||||||
margin: 0.25rem; */
|
|
||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: var(--off-bg);
|
background-color: var(--off-bg);
|
||||||
color: var(--logo);
|
color: var(--link);
|
||||||
}
|
}
|
Loading…
Reference in a new issue