diff options
| author | roninro <liumy.f@foxmail.com> | 2022-07-28 17:32:43 +0800 |
|---|---|---|
| committer | roninro <liumy.f@foxmail.com> | 2022-07-28 17:32:43 +0800 |
| commit | c953d353194ae038f1815290337a82c1cb65272c (patch) | |
| tree | 6494ad04f8907cf1136972e2a0b7f6b27d206873 /layouts | |
init
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/404.html | 3 | ||||
| -rw-r--r-- | layouts/_default/baseof.html | 109 | ||||
| -rw-r--r-- | layouts/_default/li.html | 7 | ||||
| -rw-r--r-- | layouts/_default/list.html | 23 | ||||
| -rw-r--r-- | layouts/_default/single.html | 110 | ||||
| -rw-r--r-- | layouts/_default/summary.html | 15 | ||||
| -rw-r--r-- | layouts/_default/terms.html | 20 | ||||
| -rw-r--r-- | layouts/index.html | 21 | ||||
| -rw-r--r-- | layouts/index.json | 5 | ||||
| -rw-r--r-- | layouts/partials/comments.html | 25 | ||||
| -rw-r--r-- | layouts/partials/featured-tags.html | 12 | ||||
| -rw-r--r-- | layouts/partials/footer.html | 147 | ||||
| -rw-r--r-- | layouts/partials/friends.html | 10 | ||||
| -rw-r--r-- | layouts/partials/header.html | 0 | ||||
| -rw-r--r-- | layouts/partials/intro-header.html | 61 | ||||
| -rw-r--r-- | layouts/partials/nav.html | 90 | ||||
| -rw-r--r-- | layouts/partials/search.html | 18 | ||||
| -rw-r--r-- | layouts/partials/short-about.html | 21 | ||||
| -rw-r--r-- | layouts/partials/sidebar.html | 0 | ||||
| -rw-r--r-- | layouts/partials/sns-links.html | 78 | ||||
| -rw-r--r-- | layouts/partials/tagcloud.html | 52 | ||||
| -rw-r--r-- | layouts/section/about.html | 10 | ||||
| -rw-r--r-- | layouts/section/archive.html | 29 |
23 files changed, 866 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..c1fd92c --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,3 @@ +{{ define "main" }} +<script>document.body.classList.add('page-fullscreen');</script> +{{ end }}
\ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..2b315e1 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<html lang="{{ .Site.Language.Lang }}"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + + {{ $title := .Title }} + {{ if gt (len $title) 0 }} + {{ $title = print $title " | " .Site.Title }} + {{ else }} + {{ $title = .Site.Title }} + {{ end }} + + <title>{{ $title }}</title> + + {{ with .Site.Params.author }} + <meta name="author" content="{{ . }}">{{ end }} + <meta name="description" content="{{ .Description | default (.Summary | default .Site.Params.description ) }}"> + <meta name="keywords" content="{{ (delimit .Keywords " ,") | default .Site.Params.keywords }}"> + + {{ template "_internal/twitter_cards.html" . }} + {{ template "_internal/opengraph.html" . }} + + <link rel="stylesheet" href="/css/bootstrap.min.css" crossorigin="anonymous"> + <!-- Hux change font-awesome CDN to qiniu --> + <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" + type="text/css"> + + {{ $options := (dict "outputStyle" "compressed" "enableSourceMap" (not hugo.IsProduction) "includePaths" (slice + "sass")) }} + {{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }} + <link rel="stylesheet" href="{{ $style.Permalink }}"> +</head> + +<!-- hack iOS CSS :active style --> +<body ontouchstart=""> + + {{ $header_img := .Param "header_img" }} + {{ if .IsHome }} + {{ $header_img = .Site.Params.img_home }} + {{ else if eq .Kind "404" }} + {{ $header_img = .Site.Params.img_404 }} + {{ end }} + {{ if $header_img }} + {{ .Scratch.Set "header_img" $header_img }} + {{ end }} + + {{ if and .IsPage (gt .WordCount 400 ) (.Params.toc) }} + {{ .Scratch.Set "toc" true }} + {{ end }} + + <!-- Nav --> + {{ partial "nav.html" . }} + {{ partial "search.html" . }} + + <!-- Page Header --> + {{ partial "intro-header.html" . }} + + {{ block "main" . }} + + <!-- Main Content --> + <div class="container"> + <div class="row"> + {{ if eq .Site.Params.sidebar.enable false }} + + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1 + postlist-container"> + {{ block "container" . }}{{ end }} + </div> + <!-- Sidebar Container --> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1 + sidebar-container"> + <!-- Featured Tags --> + {{ partial "featured-tags.html" }} + <!-- Friends Blog --> + {{ partial "friends.html" . }} + </div> + + {{ else }} + <!-- USE SIDEBAR --> + <!-- PostList Container --> + <div class="col-lg-8 col-lg-offset-1 col-md-8 col-md-offset-1 col-sm-12 + col-xs-12 postlist-container"> + {{ block "container" . }}{{ end }} + </div> + <!-- Sidebar Container --> + <div class="col-lg-3 col-lg-offset-0 col-md-3 col-md-offset-0 col-sm-12 + col-xs-12 sidebar-container"> + + <!-- Featured Tags --> + {{ partial "featured-tags.html" . }} + {{ partial "short-about.html" . }} + <!-- Friends Blog --> + {{ partial "friends.html" . }} + + </div> + {{ end }} + + </div> + </div> + + {{ end }} + + {{ partial "footer.html" . }} +</body> + +</html>
\ No newline at end of file diff --git a/layouts/_default/li.html b/layouts/_default/li.html new file mode 100644 index 0000000..7adca15 --- /dev/null +++ b/layouts/_default/li.html @@ -0,0 +1,7 @@ +<div class="post-preview item" data-tags="{{ with .Params.tags }} {{- delimit (apply (apply . "lower" ".") "urlquery" ".") "," -}} {{ end }}"> + <a href="{{ .Permalink }}"> + <h2 class="post-title">{{ .Title }}</h2> + <h3 class="post-subtitle">{{ .Params.subtitle }}</h3> + </a> +<hr> +</div>
\ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..26ce5a0 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,23 @@ +{{ define "main" }} +<div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <!-- Article List --> + <div class="mini-post-list"> + {{ range .Pages.GroupByDate "2006" }} + + <section class=""> + <span class="fa listing-seperator"> + <span class="tag-text">{{ .Key }}</span></span> + {{ range .Pages }} + {{ .Render "li" }} + {{ end }} + </section> + {{ end }} + </div> + + </div> + </div> +</div> + +{{ end }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..c199a65 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,110 @@ +{{ define "main" }} + +<!-- Post Content --> +<article> + <div class="container"> + <div class="row"> + + <!-- Post Container --> + <div class=" + col-lg-8 col-lg-offset-2 + col-md-10 col-md-offset-1 + post-container"> + + {{ .Content }} + + <hr style="visibility: hidden;" /> + <ul class="pager"> + {{ with .Prev }} + <li class="previous"> + <a href="{{ .Permalink }}" data-toggle="tooltip" data-placement="top" title="{{ .Title }}"> + Previous<br> + <span>{{ .Title }}</span> + </a> + </li> + {{ end }} + {{ with .Next }} + <li class="next"> + <a href="{{ .Permalink }}" data-toggle="tooltip" data-placement="top" title="{{ .Title }}"> + Next<br> + <span>{{ .Title }}</span> + </a> + </li> + {{ end }} + </ul> + <hr style="visibility: hidden;" /> + + <!-- comments --> + {{ partial "comments.html" . }} + + </div> + + <!-- Side Catalog Container --> + {{ $toc := .Scratch.Get "toc" }} + {{ if $toc }} + <div class=" + col-lg-2 col-lg-offset-0 + visible-lg-block + sidebar-container + catalog-container"> + <div class="side-catalog"> + <hr class="hidden-sm hidden-xs"> + <h5> + <a class="catalog-toggle" href="#">CATALOG</a> + </h5> + <ul class="catalog-body"></ul> + </div> + </div> + {{ end }} + <!-- Sidebar Container --> + <div class=" + col-lg-8 col-lg-offset-2 + col-md-10 col-md-offset-1 + sidebar-container"> + + <!-- Featured Tags --> + {{ .Scratch.Set "bottom" true }} + {{ partial "featured-tags.html" . }} + + <!-- Friends Blog --> + {{ partial "friends.html" . }} + </div> + </div> + </div> +</article> + +<!-- async load function --> +<script> + function async(u, c) { + var d = document, t = 'script', + o = d.createElement(t), + s = d.getElementsByTagName(t)[0]; + o.src = u; + if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); } + s.parentNode.insertBefore(o, s); + } +</script> +<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ --> +<script> + async("//cdnjs.cloudflare.com/ajax/libs/anchor-js/1.1.1/anchor.min.js", function () { + anchors.options = { + visible: 'hover', + placement: 'right', + // icon: '#' + }; + anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5'); + }) +</script> +<style> + /* place left on bigger screen */ + @media all and (min-width: 800px) { + .anchorjs-link { + position: absolute; + left: -0.75em; + font-size: 1.1em; + margin-top: -0.1em; + } + } +</style> + +{{ end }}
\ No newline at end of file diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html new file mode 100644 index 0000000..419ec44 --- /dev/null +++ b/layouts/_default/summary.html @@ -0,0 +1,15 @@ +<div class="post-preview"> + <a href="{{ .Permalink }}"> + <h2 class="post-title">{{ .Title }}</h2> + {{ with .Params.subtitle }} + <h3 class="post-subtitle">{{ . }}</h3> + {{ end }} + <div class="post-content-preview"> + {{ .Summary | plainify }} + </div> + </a> + <p class="post-meta"> + Posted by {{ with $.Params.author }} {{ $.Params.author }} {{ else }} {{ .Site.Params.author }} {{ end }} on {{ .Date.Format "Mon, Jan 2, 2006" }} + </p> +</div> +<hr>
\ No newline at end of file diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..ec52911 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,20 @@ +{{ define "main" }} + +<div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <!-- Article List --> + <div class="mini-post-list"> + + <section class=""> + <span class="fa listing-seperator"></span> + {{ range .Pages }} + {{ .Render "li" }} + {{ end }} + </section> + </div> + + </div> + </div> +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..a244c32 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,21 @@ +{{ define "container" }} +{{ $paginator := .Paginate .Site.RegularPages }} +{{ range $paginator.Pages }} + {{ .Render "summary" }} +{{ end }} + +{{ if or ($paginator.HasPrev) ($paginator.HasNext) }} +<ul class="pager"> + {{ if $paginator.HasPrev }} + <li class="previous"> + <a href="{{ .Paginator.Prev.URL }}">← Newer Posts</a> + </li> + {{ end }} + {{ if $paginator.HasNext }} + <li class="next"> + <a href="{{ .Paginator.Next.URL }}">Older Posts →</a> + </li> + {{ end }} +</ul> +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..a626377 --- /dev/null +++ b/layouts/index.json @@ -0,0 +1,5 @@ +{{- $.Scratch.Add "searchindex" slice -}} +{{- range $index, $element := .Site.RegularPages -}} + {{- $.Scratch.Add "searchindex" (dict "title" $element.Title "url" $element.RelPermalink "tags" (delimit ($element.Params.tags | default "") " ") "subtitle" ( $element.Params.subtitle | default $element.Summary) "date" ($element.Date.Format ($.Param "dateformat" | default "2 January, 2006"))) -}} +{{- end -}} +{{- $.Scratch.Get "searchindex" | jsonify -}}
\ No newline at end of file diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..b2d78e1 --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,25 @@ +{{ if (ne .Params.comment false) -}} + +{{ if .Site.DisqusShortname }} +{{ template "_internal/disqus.html" . }} +{{ end }} + +{{ $giscus := .Site.Params.giscus }} +{{ if $giscus.enable }} +<div class="giscus" id="comments"></div> +<script src="https://giscus.app/client.js" + data-repo="{{ $giscus.repo }}" + data-repo-id="{{ $giscus.repo_id }}" + data-category="{{ $giscus.category }}" + data-category-id="{{ $giscus.category_id }}" + data-mapping="pathname" + data-strict="0" + data-reactions-enabled="1" + data-emit-metadata="0" + data-input-position="{{ $giscus.input_position | default "top" }}" + data-theme="{{ $giscus.theme | default "light" }}" + crossorigin="anonymous" + async> + </script> +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/featured-tags.html b/layouts/partials/featured-tags.html new file mode 100644 index 0000000..3111f44 --- /dev/null +++ b/layouts/partials/featured-tags.html @@ -0,0 +1,12 @@ +<section> + {{ $bottom := .Scratch.Get "bottom" }} + {{ if $bottom }} + <hr class="hidden-sm hidden-xs"> + {{ end }} + <h5>FEATURED TAGS</h5> + <div class="tags"> + {{ range .Site.Taxonomies.tags }} + <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> + {{ end }} + </div> +</section>
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..9f296aa --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,147 @@ +<!-- Footer --> +<footer> + <div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <!-- SNS Link --> + {{ partial "sns-links.html" (dict "center" true "social" .Site.Params.social ) }} + <p class="copyright text-muted"> + Copyright © {{ .Site.Title }} {{ now.Format "2006" }} + <br> + Powered by <a href="https://gohugo.io">Hugo</a> + </p> + </div> + </div> + </div> +</footer> + +<script src="/js/jquery.min.js"></script> +<script src="/js/bootstrap.min.js" crossorigin="anonymous"></script> + +<!-- Custom Theme JavaScript --> +{{ $mainJs := resources.Get "js/hux-blog.js" | minify | fingerprint }} +<script src="{{ $mainJs.Permalink }}"></script> + +<!-- Simple Jekyll Search --> +<script src="/js/simple-jekyll-search.min.js"></script> + +{{ if eq .Type "archive" }} +{{ $archiveJS := resources.Get "js/archive.js" | minify | fingerprint }} +<script src='{{ $archiveJS.Permalink }}'></script> +{{ end }} + +{{ $toc := .Scratch.Get "toc" }} +{{ if $toc }} +<script type="text/javascript"> + function generateCatalog(selector) { + _containerSelector = 'div.post-container' + // init + var P = $(_containerSelector), a, n, t, l, i, c; + a = P.find('h1,h2,h3,h4,h5,h6'); + // clean + $(selector).html('') + // appending + a.each(function () { + n = $(this).prop('tagName').toLowerCase(); + i = "#" + $(this).prop('id'); + t = $(this).text(); + c = $('<a href="' + i + '" rel="nofollow">' + t + '</a>'); + l = $('<li class="' + n + '_nav"></li>').append(c); + $(selector).append(l); + }); + return true; + } + + generateCatalog(".catalog-body"); + + // toggle side catalog + $(".catalog-toggle").click((function (e) { + e.preventDefault(); + $('.side-catalog').toggleClass("fold") + })) +</script> + +{{ $navJs := resources.Get "js/jquery.nav.js" | minify | fingerprint }} +<script type="text/javascript" src='{{ $navJs.Permalink }}'></script> +<script> + /* + * Doc: https://github.com/davist11/jQuery-One-Page-Nav + * Fork by Hux to support padding + */ + $(document).ready( function () { + $('.catalog-body').onePageNav({ + currentClass: "active", + changeHash: !1, + easing: "swing", + filter: "", + scrollSpeed: 700, + scrollOffset: 0, + scrollThreshold: .2, + begin: null, + end: null, + scrollChange: null, + padding: 80 + }); + }); +</script> + + +{{ end }} + +<!-- Simple Jekyll Search --> +<script> + // https://stackoverflow.com/questions/1912501/unescape-html-entities-in-javascript + function htmlDecode(input) { + var e = document.createElement('textarea'); + e.innerHTML = input; + // handle case of empty input + return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue; + } + + SimpleJekyllSearch({ + searchInput: document.getElementById('search-input'), + resultsContainer: document.getElementById('search-results'), + json: '/index.json', + searchResultTemplate: '<div class="post-preview item"><a href="{url}"><h2 class="post-title">{title}</h2><h3 class="post-subtitle">{subtitle}</h3><hr></a></div>', + noResultsText: 'No results', + limit: 50, + fuzzy: false, + // a hack to get escaped subtitle unescaped. for some reason, + // post.subtitle w/o escape filter nuke entire search. + templateMiddleware: function (prop, value, template) { + if (prop === 'subtitle' || prop === 'title') { + if (value.indexOf("code")) { + return htmlDecode(value); + } else { + return value; + } + } + } + }); + + $(document).ready(function () { + var $searchPage = $('.search-page'); + var $searchOpen = $('.search-icon'); + var $searchClose = $('.search-icon-close'); + var $searchInput = $('#search-input'); + var $body = $('body'); + + $searchOpen.on('click', function (e) { + e.preventDefault(); + $searchPage.toggleClass('search-active'); + var prevClasses = $body.attr('class') || ''; + setTimeout(function () { + $body.addClass('no-scroll'); + }, 400) + + if ($searchPage.hasClass('search-active')) { + $searchClose.on('click', function (e) { + e.preventDefault(); + $searchPage.removeClass('search-active'); + $body.attr('class', prevClasses); // from closure + }); + $searchInput.focus(); + } + }); + }); +</script>
\ No newline at end of file diff --git a/layouts/partials/friends.html b/layouts/partials/friends.html new file mode 100644 index 0000000..f97e727 --- /dev/null +++ b/layouts/partials/friends.html @@ -0,0 +1,10 @@ +{{ $friends := .Site.Params.friends }} +{{ with $friends }} +<hr> +<h5>FRIENDS</h5> +<ul class="list-inline"> + {{ range $friends }} + <li><a href="{{ .url }}">{{ .name }}</a></li> + {{ end }} +</ul> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/header.html diff --git a/layouts/partials/intro-header.html b/layouts/partials/intro-header.html new file mode 100644 index 0000000..ae6172b --- /dev/null +++ b/layouts/partials/intro-header.html @@ -0,0 +1,61 @@ +{{ $header_img := .Scratch.Get "header_img" }} + +{{ if .IsPage }} +<style type="text/css"> + header.intro-header { + position: relative; + background-image: url('{{ with $header_img }}{{- . -}}{{ end }}'); + } +</style> +{{ if $header_img }} +<header class="intro-header "> +{{ else }} +<header class="intro-header style-text"> +{{ end }} + <div class="header-mask"></div> + <div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <div class="post-heading"> + <div class="tags"> + {{ range (.GetTerms "tags") }} + <a class="tag" href="{{ .Page.Permalink }}" title="{{ .LinkTitle}}">{{ .LinkTitle }}</a> + {{ end }} + </div> + <h1>{{ .Title }}</h1> + <h2 class="subheading">{{ $.Params.subtitle }}</h2> + <p class="post-meta"> + Posted by {{ with $.Params.author }} {{ $.Params.author }} {{ else }} {{ .Site.Params.author }} {{ end }} + on {{ .Date.Format "Mon, Jan 2, 2006" }} + </p> + </div> + </div> + </div> + </div> +</header> +{{ else }} +{{ with $header_img }} +<header class="intro-header" style="background-image: url('{{- . -}}')"> +{{ else}} +<header class="intro-header style-text"> +{{ end }} + <div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + {{ if eq (.Param "short") true }} + <div class="site-heading" id="tag-heading"> + {{ else }} + <div class="site-heading"> + {{ end }} + <h1>{{ with .Title }}{{ . }}{{ else }}{{ .Site.Title }}{{ end }}</h1> + {{ $description := .Description }} + {{ if .IsHome }} + {{ $description = .Site.Params.description }} + {{ end }} + <span class="subheading">{{ $description }}</span> + </div> + </div> + </div> + </div> +</header> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html new file mode 100644 index 0000000..9059e9a --- /dev/null +++ b/layouts/partials/nav.html @@ -0,0 +1,90 @@ +{{ $header_img := .Scratch.Get "header_img" }} +{{ $navStyle := "invert" }} +{{ with $header_img }} +{{ $navStyle = "" }} +{{ end }} + +<nav class="navbar navbar-default navbar-custom navbar-fixed-top {{ $navStyle }}"> + <div class="container-fluid"> + <!-- Brand and toggle get grouped for better mobile display --> + <div class="navbar-header page-scroll"> + <button type="button" class="navbar-toggle"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="{{ .Site.BaseURL | safeURL }}">{{ .Site.Title }}</a> + </div> + <!-- Collect the nav links, forms, and other content for toggling --> + <div id="huxblog_navbar"> + <div class="navbar-collapse"> + <ul class="nav navbar-nav navbar-right"> + {{ range .Site.Menus.main }} + <li><a href="{{ .URL | safeURL }}" title="{{ .Name }}">{{ .Name }}</a></li> + {{ end }} + + <li class="search-icon"> + <a href="javascript:void(0)"> + <i class="fa fa-search"></i> + </a> + </li> + </ul> + </div> + </div> + <!-- /.navbar-collapse --> + </div> + <!-- /.container --> +</nav> +<script> + // Drop Bootstarp low-performance Navbar + // Use customize navbar with high-quality material design animation + // in high-perf jank-free CSS3 implementation + var $body = document.body; + var $toggle = document.querySelector(".navbar-toggle"); + var $navbar = document.querySelector("#huxblog_navbar"); + var $collapse = document.querySelector(".navbar-collapse"); + + var __HuxNav__ = { + close: function () { + $navbar.className = " "; + // wait until animation end. + setTimeout(function () { + // prevent frequently toggle + if ($navbar.className.indexOf("in") < 0) { + $collapse.style.height = "0px"; + } + }, 400); + }, + open: function () { + $collapse.style.height = "auto"; + $navbar.className += " in"; + }, + }; + + // Bind Event + $toggle.addEventListener("click", function (e) { + if ($navbar.className.indexOf("in") > 0) { + __HuxNav__.close(); + } else { + __HuxNav__.open(); + } + }); + + /** + * Since Fastclick is used to delegate 'touchstart' globally + * to hack 300ms delay in iOS by performing a fake 'click', + * Using 'e.stopPropagation' to stop 'touchstart' event from + * $toggle/$collapse will break global delegation. + * + * Instead, we use a 'e.target' filter to prevent handler + * added to document close HuxNav. + * + * Also, we use 'click' instead of 'touchstart' as compromise + */ + document.addEventListener("click", function (e) { + if (e.target == $toggle) return; + if (e.target.className == "icon-bar") return; + __HuxNav__.close(); + }); +</script>
\ No newline at end of file diff --git a/layouts/partials/search.html b/layouts/partials/search.html new file mode 100644 index 0000000..c2db376 --- /dev/null +++ b/layouts/partials/search.html @@ -0,0 +1,18 @@ +<!-- Search --> +<div class="search-page"> + <div class="search-icon-close-container"> + <span class="search-icon-close"> + <i class="fa fa-chevron-down"></i> + </span> + </div> + <div class="search-main container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + <form></form> + <input type="text" id="search-input" placeholder="$ grep..."> + </form> + <div id="search-results" class="mini-post-list"></div> + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/short-about.html b/layouts/partials/short-about.html new file mode 100644 index 0000000..a560382 --- /dev/null +++ b/layouts/partials/short-about.html @@ -0,0 +1,21 @@ + +<section class="visible-md visible-lg"> + <hr> + {{ with .Site.GetPage "/about" }} + <h5><a href="/about/">ABOUT ME</a></h5> + {{ else }} + <h5>ABOUT ME</h5> + {{ end }} + + {{ $sidebar := .Site.Params.sidebar }} + <div class="short-about"> + {{ with $sidebar.avatar }} + <img src="{{ $sidebar.avatar }}" /> + {{ end }} + {{ with $sidebar.bio }} + <p>{{ $sidebar.bio }}</p> + {{ end }} + <!-- SNS Link --> + {{ partial "sns-links.html" (dict "center" false "social" .Site.Params.social ) }} + </div> +</section>
\ No newline at end of file diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/sidebar.html diff --git a/layouts/partials/sns-links.html b/layouts/partials/sns-links.html new file mode 100644 index 0000000..0e8383f --- /dev/null +++ b/layouts/partials/sns-links.html @@ -0,0 +1,78 @@ +{{ $social := .social }} + +{{ if .center }} +<ul class="list-inline text-center"> +{{ else }} +<ul class="list-inline"> +{{ end}} + {{ with $social.rss_enable }} + <li> + <a href="/feed.xml"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-rss fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} + {{ with $social.twitter }} + <li> + <a href="https://twitter.com/{{ . }}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-twitter fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} + {{ with $social.zhihu }} + <li> + <a target="_blank" href="https://www.zhihu.com/people/{{ . }}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-stack-1x fa-inverse">知</i> + </span> + </a> + </li> + {{ end }} + {{ with $social.weibo }} + <li> + <a target="_blank" href="http://weibo.com/{{ . }}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-weibo fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} + {{ with $social.facebook }} + <li> + <a target="_blank" href="https://www.facebook.com/{{ . }}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-facebook fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} + {{ with $social.github }} + <li> + <a target="_blank" href="https://github.com/{{ . }}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-github fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} + {{ with $social.linkedin }} + <li> + <a target="_blank" href="https://www.linkedin.com/in/{{ . }}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-circle fa-stack-2x"></i> + <i class="fa fa-linkedin fa-stack-1x fa-inverse"></i> + </span> + </a> + </li> + {{ end }} +</ul>
\ No newline at end of file diff --git a/layouts/partials/tagcloud.html b/layouts/partials/tagcloud.html new file mode 100644 index 0000000..73e04eb --- /dev/null +++ b/layouts/partials/tagcloud.html @@ -0,0 +1,52 @@ +{{ $pages := .Site.RegularPages }} + +{{ if not (eq (len $.Site.Taxonomies.tags) 0) }} + +{{ $lens := slice }} +{{ range $.Site.Taxonomies.tags }} +{{ $lens = $lens | append .Count }} +{{ end }} + +{{ $lens = $lens | uniq | sort }} + +{{ $max := index $lens (sub (len $lens) 1) }} +{{ $min := index $lens 0 }} + +{{ $spread := sub $max $min }} +{{ if eq $spread 0 }} +{{ $spread = 1 }} +{{ end }} + +<style type="text/css"> +{{ range $lens }} + +{{ $sassTemplate := resources.Get "sass/tagcolor-template.scss" }} +{{ $params := dict "weighting" (sub . $min) "spread" $spread "count" . }} + +{{ $style := $sassTemplate | resources.ExecuteAsTemplate (printf "tagscolors__%d.css" .) $params | resources.ToCSS }} +{{ with $style }} + {{ .Content | safeCSS }} +{{ end }} + +{{ end }} +</style> +<div id='tag_cloud' class="tags tags-sup js-tags"> + <a class="tag-button--all" data-encode=""> + Show All + <sup>{{ len $pages }}</sup> + </a> + + {{ range .Site.Taxonomies.tags.ByCount }} +<a data-sort="{{ printf " %04d" (sub (len $pages) .Count) }}" data-encode="{{ .Page.Title | urlquery }}" + class="tag-button tag-color__{{ .Count }}" title="{{ .Page.Title }}" rel="{{ .Count }}"> + {{ .Page.Title }} + <sup>{{ .Count }}</sup> +</a> +{{ end }} +</div> +{{ end }} + + + + + diff --git a/layouts/section/about.html b/layouts/section/about.html new file mode 100644 index 0000000..5c77571 --- /dev/null +++ b/layouts/section/about.html @@ -0,0 +1,10 @@ +{{ define "container" }} + +<div class="post-container"> + + {{ .Content }} +</div> + +{{ partial "comments.html" . }} + +{{ end }}
\ No newline at end of file diff --git a/layouts/section/archive.html b/layouts/section/archive.html new file mode 100644 index 0000000..08d12f3 --- /dev/null +++ b/layouts/section/archive.html @@ -0,0 +1,29 @@ +{{ define "main" }} + +{{ $pages := .Site.RegularPages }} +<!-- Main Content --> +<div class="container"> + <div class="row"> + <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> + {{ partial "tagcloud.html" . }} + + <!-- Article List --> + <div class="mini-post-list js-result"> + + {{ range $pages.GroupByDate "2006" }} + + <section class=""> + <span class="fa listing-seperator"> + <span class="tag-text">{{ .Key }}</span></span> + {{ range .Pages }} + {{ .Render "li" }} + {{ end }} + </section> + {{ end }} + + </div> + </div> + </div> +</div> + +{{ end }}
\ No newline at end of file |
