From 3a223545b912db31bd2cf46f2921e303edc296f5 Mon Sep 17 00:00:00 2001 From: Aiden X Date: Thu, 13 Aug 2020 22:18:49 +0800 Subject: feat(single): add new page --- assets/scss/_footer.scss | 17 +++++++++++++++ assets/scss/_single.scss | 52 ++++++++++++++++++++++++++++++++++++++++++++ assets/scss/less.scss | 38 ++++++++++++++++++++++++++++++-- assets/scss/single.scss | 14 ------------ layouts/_default/single.html | 1 - layouts/index.html | 40 ++++++++++++++++++++-------------- layouts/partials/footer.html | 9 ++++++-- layouts/partials/header.html | 14 +++++------- 8 files changed, 142 insertions(+), 43 deletions(-) create mode 100644 assets/scss/_footer.scss create mode 100644 assets/scss/_single.scss delete mode 100644 assets/scss/single.scss 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}} {{.Content}} - 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 @@
- {{ $paginator := .Paginate (where .Site.RegularPages "Section" "posts") }} - {{ range $paginator.Pages }} -
-
- + {{ range (.Site.RegularPages.GroupByDate "2006") }} +
+
{{ .Key }}
+ {{ range .Pages }} +
+
+ +
+
+ + {{.Title}} + +
+ {{ $length := (len .Summary) }} + {{ if gt (len .Summary) 100 }} + {{ $length = 100 }} + {{ end }} + {{ slicestr .Summary 0 $length | plainify | htmlUnescape }} +
+
+
+ {{ end }}
-
- - {{.Title}} - -
- {{.Summary}} -
-
-
{{ end }}
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 @@ -
-
+
+ +
\ 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,22 +5,20 @@ - {{ $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 }} + - 常·九 + 面向自由编程