Merge pull request #39 from liwenyip/google-custom-search
Added support for Google Custom Search Engine
This commit is contained in:
commit
625176f1ce
@ -16,6 +16,7 @@ pygmentCodeFences = true
|
|||||||
commit = false
|
commit = false
|
||||||
rss = true
|
rss = true
|
||||||
comments = true
|
comments = true
|
||||||
|
# gcse = "012345678901234567890:abcdefghijk" # Get your code from google.com/cse. Make sure to go to "Look and Feel" and change Layout to "Full Width" and Theme to "Classic"
|
||||||
|
|
||||||
#[[Params.bigimg]]
|
#[[Params.bigimg]]
|
||||||
# src = "img/triangle.jpg"
|
# src = "img/triangle.jpg"
|
||||||
|
@ -205,5 +205,17 @@
|
|||||||
<script src="{{ .Site.BaseURL }}/js/highlight.min.js"></script>
|
<script src="{{ .Site.BaseURL }}/js/highlight.min.js"></script>
|
||||||
<script> hljs.initHighlightingOnLoad(); </script>
|
<script> hljs.initHighlightingOnLoad(); </script>
|
||||||
<script> renderMathInElement(document.body); </script>
|
<script> renderMathInElement(document.body); </script>
|
||||||
|
<!-- Google Custom Search Engine -->
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
var cx = '{{ .Site.Params.gcse }}';
|
||||||
|
var gcse = document.createElement('script');
|
||||||
|
gcse.type = 'text/javascript';
|
||||||
|
gcse.async = true;
|
||||||
|
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
||||||
|
var s = document.getElementsByTagName('script')[0];
|
||||||
|
s.parentNode.insertBefore(gcse, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
{{ template "_internal/google_analytics.html" . }}
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if isset .Site.Params "gcse" }}
|
||||||
|
<li>
|
||||||
|
<a href="#modalSearch" data-toggle="modal" data-target="#modalSearch" style="outline: none;">
|
||||||
|
<span class="hidden-sm hidden-md hidden-lg">Search</span> <span id="searchGlyph" class="glyphicon glyphicon-search"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -43,3 +50,23 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<!-- Search Modal -->
|
||||||
|
{{ if isset .Site.Params "gcse" }}
|
||||||
|
<div id="modalSearch" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
|
<h4 class="modal-title">Search {{ .Site.Title }}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<gcse:search></gcse:search>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
@ -680,4 +680,18 @@ td.gutter {
|
|||||||
|
|
||||||
#social-share-section {
|
#social-share-section {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Google Custom Search Engine Popup --- */
|
||||||
|
#modalSearch table tr, #modalSearch table tr td, #modalSearch table tr th {
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
.reset-box-sizing, .reset-box-sizing *, .reset-box-sizing *:before, .reset-box-sizing *:after, .gsc-inline-block {
|
||||||
|
-webkit-box-sizing: content-box;
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
input.gsc-input, .gsc-input-box, .gsc-input-box-hover, .gsc-input-box-focus, .gsc-search-button {
|
||||||
|
box-sizing: content-box;
|
||||||
|
line-height: normal;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user