浏览代码

Featured image support

Track3 6 年之前
父节点
当前提交
afae9116a6

+ 1 - 0
archetypes/posts.md

@@ -2,6 +2,7 @@
 title: "{{ replace .Name "-" " " | title }}"
 date: {{ .Date }}
 draft: true
+featuredImg: ""
 tags: 
   - blog
   - story

+ 1 - 0
content/posts/2017/3-years-of-win10.md

@@ -2,6 +2,7 @@
 title: 三年Win10,回首
 date: 2017-10-02T20:40:21+08:00
 draft: false
+featuredImg: "https://ojirvqiyr.qnssl.com/images/2017/win10.jpg"
 tags:
   - Windows 
 ---

+ 1 - 0
content/posts/2017/goodbye-my-windows-phone.md

@@ -2,6 +2,7 @@
 title: 别了,我的Windows Phone
 date: 2017-08-14T21:47:52+08:00
 draft: false
+featuredImg: "https://ojirvqiyr.qnssl.com/images/2017/lumia-830.jpg"
 tags:
   - Windows
 ---

+ 1 - 0
content/posts/2017/raspberrypi-lede-setup.md

@@ -2,6 +2,7 @@
 title: 变身智能路由器,树莓派配置LEDE
 date: 2017-05-29T17:25:44+08:00
 draft: false
+featuredImg: "https://ojirvqiyr.qnssl.com/images/2017/Buy_Pi_Cover-01.png"
 tags:
   - 折腾
   - 树莓派

+ 1 - 0
content/posts/2017/stories-behind-amd.md

@@ -3,6 +3,7 @@ title: 写在“锐龙”上市之际——AMD那段励志的故事
 date: 2017-02-24T20:27:13+08:00
 draft: false
 excerpt: 十年磨一剑,AMD Ryzen终于来了。可是AMD背后的故事,又有多少人了解?
+featuredImg: "https://ojirvqiyr.qnssl.com/images/2017/amd-ryzen.jpg"
 tags:
   - AMD
   - Intel

+ 1 - 0
layouts/_default/baseof.html

@@ -21,6 +21,7 @@
 		{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}
 	{{ end -}}
 	<link rel="stylesheet" href="{{ "css/style.css" | absURL }}">
+	{{ block "head" . -}}{{- end }}
 </head>
 
 <body id="page">

+ 3 - 0
layouts/posts/single.html

@@ -3,6 +3,9 @@
 {{ end }}
 
 {{ define "main" }}
+	{{- with .Params.featuredImg }}
+		<div class="bg-img" style="width: 100%;height: 100%;opacity: .03;z-index: -1;position: fixed;top: 0;background-image: url({{.}});background-attachment: fixed;background-repeat: no-repeat;background-size: cover;"></div>
+	{{- end }}
 	<main class="site-main section-inner animated bounceInUp">
 		<article class="thin">
 			<header class="post-header">