浏览代码

Merge pull request #71 from HcySunYang/feature-zhangxiao

add ads
Huo Chunyang 7 年之前
父节点
当前提交
af6fe66d57
共有 2 个文件被更改,包括 38 次插入0 次删除
  1. 3 0
      docs/.vuepress/config.js
  2. 35 0
      docs/.vuepress/theme/Layout.vue

+ 3 - 0
docs/.vuepress/config.js

@@ -3,6 +3,9 @@ module.exports = {
   title: 'Vue技术内幕',
   ga: 'UA-120533817-1',
   description: '逐行级别的 Vue 源码分析',
+  head: [
+    ['script', { async: '', src: 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' }]
+  ],
   markdown: {
     toc: {
       includeLevel: [2, 3, 4, 5, 6]

+ 35 - 0
docs/.vuepress/theme/Layout.vue

@@ -0,0 +1,35 @@
+<template>
+  <Layout>
+    <div slot="sidebar-top">
+      <ins class="adsbygoogle"
+        style="display:inline-block;width:100%;height:120px"
+        data-ad-client="ca-pub-4613560834313397"
+        data-ad-slot="2465217753">
+      </ins>
+    </div>
+  </Layout>
+</template>
+
+<script>
+import Layout from '@default-theme/Layout.vue'
+
+export default {
+  components: {
+    Layout,
+  },
+  mounted() {
+    setTimeout(() => {
+      const adsbygoogle = window.adsbygoogle || []
+      adsbygoogle.push({})
+    }, 0)
+  }
+}
+</script>
+<style lang="stylus">
+.google-ads
+  width 100%
+  height 120px
+  padding 1.5rem 1.5rem 0
+  margin-bottom -.5rem
+  font-size .75rem
+</style>