-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #551 from hugo-fixit/google-cse
✨ Feat: add Google CSE support
- Loading branch information
Showing
11 changed files
with
126 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: {{ T "assets.search" }} | ||
layout: search | ||
date: {{ .Date }} | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,7 @@ header { | |
} | ||
} | ||
|
||
.search { | ||
.menu .search { | ||
position: relative; | ||
|
||
input { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,3 @@ | |
@import '_home'; | ||
@import '_404'; | ||
@import '_offline'; | ||
@import '_friends'; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
assets/css/_page/_friends.scss → assets/css/_page/_special/_friends.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.special { | ||
.single-title, | ||
.single-subtitle { | ||
text-align: right; | ||
} | ||
|
||
&.friends { | ||
@import '_friends'; | ||
} | ||
|
||
&.search { | ||
@import '_search'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Style of layout named 'search' | ||
// TODO Adapting to dark mode, maybe use css variables | ||
|
||
// Google CSE | ||
.gcse-searchbox:empty, | ||
.gcse-searchresults:empty { | ||
display: none; | ||
} | ||
|
||
// Bing CSE (Unsupported) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- define "title" -}} | ||
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} | ||
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "content" -}} | ||
{{- $params := partial "function/params.html" -}} | ||
{{- $cse := .Site.Params.cse -}} | ||
<article class="page single special search"> | ||
<div class="header"> | ||
{{- /* Title */ -}} | ||
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}</h1> | ||
|
||
{{- /* Subtitle */ -}} | ||
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}} | ||
</div> | ||
|
||
{{- /* Content */ -}} | ||
<div class="content" id="content"> | ||
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} | ||
</div> | ||
|
||
{{- /* Google CSE */ -}} | ||
{{- if eq $cse.engine "google" -}} | ||
{{- with $cse.google.cx -}} | ||
<script async defer src="https://cse.google.com/cse.js?cx={{ . }}"></script> | ||
<div class="gcse-searchbox"></div> | ||
<div class="gcse-searchresults"></div> | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- /* Bing CSE (Unsupported) */ -}} | ||
</article> | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters