diff options
author | Aiden X <caichao.xu@gmail.com> | 2020-08-13 17:18:49 +0300 |
---|---|---|
committer | Aiden X <caichao.xu@gmail.com> | 2020-08-13 17:18:49 +0300 |
commit | 3a223545b912db31bd2cf46f2921e303edc296f5 (patch) | |
tree | ab108fae8f9b138d3cb8b428695c02e9d1c81356 | |
parent | b0b26a9eb4e687c3fe37c050fe45a87fe63ac3f7 (diff) |
feat(single): add new page
-rw-r--r-- | assets/scss/_footer.scss | 17 | ||||
-rw-r--r-- | assets/scss/_single.scss | 52 | ||||
-rw-r--r-- | assets/scss/less.scss | 38 | ||||
-rw-r--r-- | assets/scss/single.scss | 14 | ||||
-rw-r--r-- | layouts/_default/single.html | 1 | ||||
-rw-r--r-- | layouts/index.html | 40 | ||||
-rw-r--r-- | layouts/partials/footer.html | 9 | ||||
-rw-r--r-- | layouts/partials/header.html | 14 |
8 files changed, 142 insertions, 43 deletions
diff --git a/assets/scss/_footer.scss b/assets/scss/_footer.scss new file mode 100644 index 0000000..9ac7e5c --- /dev/null +++ b/assets/scss/_footer.scss @@ -0,0 +1,17 @@ + +footer { + padding: 20px 0; + @include flex-y-center; + justify-content: center; + text-align: center; + color: #5D5C5C; + + a { + color: #5D5C5C; + } + + .copyright { + margin-left: 20px; + margin-right: 20px; + } +}
\ No newline at end of file diff --git a/assets/scss/_single.scss b/assets/scss/_single.scss new file mode 100644 index 0000000..18c9dcc --- /dev/null +++ b/assets/scss/_single.scss @@ -0,0 +1,52 @@ + +.single { + line-height: 2; + color: #4C4E4D; + font-size: 16px; + + .single-title { + font-size: 36px; + text-align: center; + margin-bottom: 40px; + font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + } + + pre { + border-radius: 2px; + padding: 20px; + + code { + font-family: "menlo", serif; + font-size: 14px; + } + } + + p { + margin: 30px 0 30px; + } + + h1, h2, h3, h4, h5, h6 { + margin: 30px 0 30px; + font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + } + + h1 { + font-size: 28px; + } + + h2 { + font-size: 26px; + } + + h3 { + font-size: 24px; + } + + h4 { + font-size: 22px; + } + + ol, ul { + padding-left: 30px; + } +}
\ No newline at end of file diff --git a/assets/scss/less.scss b/assets/scss/less.scss index d2bf808..4866f82 100644 --- a/assets/scss/less.scss +++ b/assets/scss/less.scss @@ -1,5 +1,6 @@ @import "../../node_modules/@forever9/lego/lego"; @import "single"; +@import "footer"; @include container(); @include row(); @@ -25,7 +26,7 @@ html { } body { - font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; + font-family: -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; background: #fff; } @@ -66,12 +67,35 @@ a { } } +.posts { + margin-bottom: 40px; + + &:nth-child(2n+1) { + .post-right { + &:before { + background: #71D6E8; + } + } + } + + .post { + &:last-child { + .post-right { + &:after { + display: none; + } + } + } + } +} + .post { display: flex; } .post-left { min-width: 50px; + line-height: 1.5; } .post-title { @@ -116,4 +140,14 @@ a { left: 3px; top: 20px; } -}
\ No newline at end of file +} + +.post-title { + font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif; +} + +.year { + font-size: 20px; + margin-bottom: 30px; + font-weight: 500; +} diff --git a/assets/scss/single.scss b/assets/scss/single.scss deleted file mode 100644 index f335114..0000000 --- a/assets/scss/single.scss +++ /dev/null @@ -1,14 +0,0 @@ - -.single { - line-height: 1.5; - color: #4C4E4D; - .single-title { - font-size: 36px; - text-align: center; - margin-bottom: 40px; - } - - p { - margin-bottom: 30px; - } -}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index edeecda..cf0926a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,7 +8,6 @@ {{.Title}} </div> {{.Content}} - </div> </div> </div> diff --git a/layouts/index.html b/layouts/index.html index 9655e8e..04da3f9 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -3,23 +3,31 @@ <div class="container"> <div class="row"> <div class="column is-md-8 is-offset-2 main"> - {{ $paginator := .Paginate (where .Site.RegularPages "Section" "posts") }} - {{ range $paginator.Pages }} - <div class="post"> - <div class="post-left"> - <span class="post-date"> - {{ .Date.Format "01-02" }} - </span> + {{ range (.Site.RegularPages.GroupByDate "2006") }} + <div class="posts"> + <div class="year">{{ .Key }}</div> + {{ range .Pages }} + <div class="post"> + <div class="post-left"> + <span class="post-date"> + {{ .Date.Format "01-02" }} + </span> + </div> + <div class="post-right"> + <a class="post-title" href="{{.Permalink}}"> + {{.Title}} + </a> + <div class="post-summary"> + {{ $length := (len .Summary) }} + {{ if gt (len .Summary) 100 }} + {{ $length = 100 }} + {{ end }} + {{ slicestr .Summary 0 $length | plainify | htmlUnescape }} + </div> + </div> + </div> + {{ end }} </div> - <div class="post-right"> - <a class="post-title" href="{{.Permalink}}"> - {{.Title}} - </a> - <div class="post-summary"> - {{.Summary}} - </div> - </div> - </div> {{ end }} </div> </div> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 9492c2b..74164f0 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,5 +1,10 @@ -<footer> -</footer> +<div class="container"> + <footer> + <div>Less is More</div> + <span class="copyright">©2018-{{now.Year}}</span> + <a href="">粤ICP备120011798号</a> + </footer> +</div> </body> </html>
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 35b5cf7..b330262 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -5,23 +5,21 @@ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> - {{ $sass := resources.Get "scss/less.scss" }} - {{ $style := $sass | resources.ToCSS }} + {{ $options := (dict "targetPath" "less.css" "outputStyle" "compressed" "enableSourceMap" true) }} + {{ $style := resources.Get "scss/less.scss" | resources.ToCSS $options }} + <link href="/images/logo.png" rel="icon" type="image/ico"> <link rel="stylesheet" href="{{ $style.Permalink }}"> <link rel="stylesheet" href="//at.alicdn.com/t/font_1995642_svj67i6zduq.css"> - <title>常·九</title> + <title>面向自由编程</title> </head> <body> <div class="container"> <div class="nav"> - <figure class="logo"> + <a class="logo" href="/"> <img src="/images/logo.png" alt=""> - </figure> + </a> <ul class="nav-menu"> <li> - <a href="">首页</a> - </li> - <li> <a href="">系列</a> </li> <li> |