diff options
author | wd <wd@wdicc.com> | 2017-03-11 10:59:31 +0300 |
---|---|---|
committer | wd <wd@wdicc.com> | 2017-03-11 10:59:31 +0300 |
commit | 041293c8388c4dae4b83029ff1a3140b1274cebc (patch) | |
tree | be49e5a011661254ee8057a9c00514002514314a | |
parent | a0b32e0b6568b4dc6876773ec2e9cfe6a3f0858f (diff) |
Add highlight support and many others feature
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | layouts/_default/terms.html | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 30 | ||||
-rw-r--r-- | static/css/custom.css | 19 | ||||
-rw-r--r-- | static/css/hljs.css | 126 | ||||
-rw-r--r-- | static/font/hermit-medium-webfont.eot | bin | 0 -> 22804 bytes | |||
-rw-r--r-- | static/font/hermit-medium-webfont.ttf | bin | 0 -> 54144 bytes | |||
-rw-r--r-- | static/font/hermit-medium-webfont.woff | bin | 0 -> 24792 bytes |
8 files changed, 43 insertions, 150 deletions
@@ -1,6 +1,14 @@ # hugo-fabric Hugo Fabric Theme, forked from https://github.com/wd/hexo-fabric. You can visit live demo at https://wdicc.com. +# Features + +* Support archives (But archives page and tags page didn't support pagination :( ) +* Tags list +* RSS link and social account links +* Disqus support +* Use Highlight.js for code highlight + # Installation First clone this repository in the `themes/` directory: @@ -44,6 +52,10 @@ Put settings below into your config.toml. addthis_profile_id = "wd" ``` +# Code highlight + +If you want to change to your favourite highlight style, just download the css file and replace `themes/hugo-fabric/static/css/hljs.css`. + # Archive support Create a new file `hugo new archives.md`, and edit this file, add the following line in front matter. @@ -52,6 +64,10 @@ Create a new file `hugo new archives.md`, and edit this file, add the following type = "archives" ``` +# Todo + +* TOC support + # Others * https://github.com/wd/hexo2hugo diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index 22ee845..7452a69 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -2,6 +2,6 @@ {{ $site := .Site }} {{ $data := .Data }} {{ range $key, $value := .Data.Terms.Alphabetical }} -<a href="{{ $site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}">{{ $value.Name }}</a>({{ $value.Count }}) +<a href="{{ $site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}">{{ $value.Name }}</a><sup class="tagcount">{{ $value.Count }}</sup> {{ end }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 36e3edb..3b23ff4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -2,28 +2,13 @@ <html> <head> <meta charset="utf-8"> - <!-- - var title = page.title; - - if (is_archive()){ - title = 'Archives'; - - if (is_month()){ - title += ': ' + page.year + '/' + page.month; - } else if (is_year()){ - title += ': ' + page.year; - } - } else if (is_category()){ - title = 'Category: ' + page.category; - } else if (is_tag()){ - title = 'Tag: ' + page.tag; - } - --> {{ $.Scratch.Add "title" "" }} - {{ if eq .Type "Archives" }} - {{ $.Scratch.Set "title" "Archives" }} + {{ if eq .Type "archives" }} + {{ $.Scratch.Set "title" "Archives" }} + {{ else if ne .Title .Site.Title }} + {{ $.Scratch.Set "title" .Title }} {{ end }} - <title>{{ if $.Scratch.Get "title" }}{{ $.Scratch.Get "title" }} - {{ end }}{{ .Title }}</title> + <title>{{ if $.Scratch.Get "title" }}{{ $.Scratch.Get "title" }} - {{ end }}{{ .Site.Title }}</title> <meta name="author" content="{{ .Site.Params.author }}"> <meta name="description" content="{{ .Description }}"> <meta name="keywords" content="{{ range .Keywords }}{{ . }},{{ end }}"> @@ -33,7 +18,6 @@ <link href="/favicon.ico" rel="shortcut icon"> <link href="/css/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> <link href="/css/custom.css" media="screen, projection" rel="stylesheet" type="text/css"> - <link href="/css/hljs.css" media="screen, projection" rel="stylesheet" type="text/css"> <link href='//fonts.googleapis.com/css?family=Slackey' rel='stylesheet' type='text/css'> <link href='//fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'> @@ -44,4 +28,8 @@ <script type="text/javascript" src="/js/jquery-tapir.js"></script> {{ template "_internal/google_analytics_async.html" . }} + + <link rel="stylesheet" href="/css/hljs.css"> + <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script> + <script>hljs.initHighlightingOnLoad();</script> </head> diff --git a/static/css/custom.css b/static/css/custom.css index 96fa0a0..3188a29 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,3 +1,11 @@ +@font-face{ + font-family: 'MyHermit'; + src: url('/font/hermit-medium-webfont.eot'); + src: url('/font/hermit-medium-webfont.eot?#iefix') format('embedded-opentype'), + url('/font/hermit-medium-webfont.woff') format('woff'), + url('/font/hermit-medium-webfont.ttf') format('truetype'); +} + .subtitle { float: right; font-family: 'Slackey',cursive; @@ -5,12 +13,15 @@ margin-right: 100px; } +.tagcount { + color: #bbb; +} + /* for code */ -article code, article pre { +article code { background: oldlace; border: 1px solid oldlace; - font-family: "Hermit", Monaco, "Andale Mono", "lucida console", "Courier New", monospace; } -article code { + font-family: "MyHermit", "Hermit", "Monaco", "Andale Mono", "lucida console", "Courier New", monospace; font-size: 0.9em; padding: 1px 3px; margin: 0 3px; @@ -19,11 +30,13 @@ article code { -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; } + article pre { font-size: 1 / 0.9em; line-height: 1.5; margin-top: 10px; padding: 5px 15px; + font-family: "Myhermit", "Hermit", "Monaco", "Andale Mono", "lucida console", "Courier New", monospace; overflow-x: auto; -webkit-border-radius: 5px; -moz-border-radius: 5px; diff --git a/static/css/hljs.css b/static/css/hljs.css index a8f730d..817e732 100644 --- a/static/css/hljs.css +++ b/static/css/hljs.css @@ -1,125 +1 @@ -/* - -github.com style (c) Vasily Polovnyov <vast@whiteants.net> - -*/ - -.hljs { - display: block; padding: 0.5em; - color: #333; - background: #f8f8f8 -} - -.code .comment, -.code .template_comment, -.diff .code .header, -.code .javadoc { - color: #998; - font-style: italic -} - -.code .keyword, -.css .rule .code .keyword, -.code .winutils, -.javascript .code .title, -.nginx .code .title, -.code .subst, -.code .request, -.code .status { - color: #333; - font-weight: bold -} - -.code .number, -.code .hexcolor, -.ruby .code .constant { - color: #099; -} - -.code .string, -.code .tag .code .value, -.code .phpdoc, -.tex .code .formula { - color: #d14 -} - -.code .title, -.code .id, -.coffeescript .code .params, -.scss .code .preprocessor { - color: #900; - font-weight: bold -} - -.javascript .code .title, -.lisp .code .title, -.clojure .code .title, -.code .subst { - font-weight: normal -} - -.code .class .code .title, -.haskell .code .type, -.vhdl .code .literal, -.tex .code .command { - color: #458; - font-weight: bold -} - -.code .tag, -.code .tag .code .title, -.code .rules .code .property, -.django .code .tag .code .keyword { - color: #000080; - font-weight: normal -} - -.code .attribute, -.code .variable, -.lisp .code .body { - color: #008080 -} - -.code .regexp { - color: #009926 -} - -.code .symbol, -.ruby .code .symbol .code .string, -.lisp .code .keyword, -.tex .code .special, -.code .prompt { - color: #990073 -} - -.code .built_in, -.lisp .code .title, -.clojure .code .built_in { - color: #0086b3 -} - -.code .preprocessor, -.code .pragma, -.code .pi, -.code .doctype, -.code .shebang, -.code .cdata { - color: #999; - font-weight: bold -} - -.code .deletion { - background: #fdd -} - -.code .addition { - background: #dfd -} - -.diff .code .change { - background: #0086b3 -} - -.code .chunk { - color: #aaa -} +.hljs{display:block;overflow-x:auto;padding:0.5em;color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#333;font-weight:bold}.hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable,.hljs-tag .hljs-attr{color:#008080}.hljs-string,.hljs-doctag{color:#d14}.hljs-title,.hljs-section,.hljs-selector-id{color:#900;font-weight:bold}.hljs-subst{font-weight:normal}.hljs-type,.hljs-class .hljs-title{color:#458;font-weight:bold}.hljs-tag,.hljs-name,.hljs-attribute{color:#000080;font-weight:normal}.hljs-regexp,.hljs-link{color:#009926}.hljs-symbol,.hljs-bullet{color:#990073}.hljs-built_in,.hljs-builtin-name{color:#0086b3}.hljs-meta{color:#999;font-weight:bold}.hljs-deletion{background:#fdd}.hljs-addition{background:#dfd}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold} diff --git a/static/font/hermit-medium-webfont.eot b/static/font/hermit-medium-webfont.eot Binary files differnew file mode 100644 index 0000000..f9cc496 --- /dev/null +++ b/static/font/hermit-medium-webfont.eot diff --git a/static/font/hermit-medium-webfont.ttf b/static/font/hermit-medium-webfont.ttf Binary files differnew file mode 100644 index 0000000..72dfdf5 --- /dev/null +++ b/static/font/hermit-medium-webfont.ttf diff --git a/static/font/hermit-medium-webfont.woff b/static/font/hermit-medium-webfont.woff Binary files differnew file mode 100644 index 0000000..7c57d3d --- /dev/null +++ b/static/font/hermit-medium-webfont.woff |