Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit f7dbd92

Browse files
feat: integrate mailchimp (#49)
* feat: intergrate mailchimp plugin * docs: add newsletter
1 parent 4373f16 commit f7dbd92

16 files changed

+244
-1
lines changed

docs/config/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,20 @@ Service to accomplish commenting.
218218
Other options depend on which service you pick since this feature is accomplished by the plugins below. All options except `service` will be passed directly to the plugin, so take a look at their documentation for more details:
219219
- [vuepress-plugin-disqus-comment](https://vuepress-plugin-disqus.netlify.com/#config)
220220
- [vuepress-plugin-vssue](https://vssue.js.org/guide/vuepress.html#usage)
221+
222+
## newsletter
223+
224+
- Type: `object`
225+
- Default: `{}`
226+
- Required: `false`
227+
228+
It will be enabled when `endpoint` is provided. e.g.
229+
230+
```js
231+
{
232+
endpoint: 'https://billyyyyy3320.us4.list-manage.com/subscribe/post?u=4905113ee00d8210c2004e038&id=bd18d40138'
233+
}
234+
```
235+
[vuepress-plugin-mailchimp](https://vuepress-plugin-mailchimp.billyyyyy3320.com/) is how we implement the feature. This config will be pass directly to it, so please head [vuepress-plugin-mailchimp](https://vuepress-plugin-mailchimp.billyyyyy3320.com/#config) for more details.
236+
237+

docs/guide/getting-started.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,27 @@ module.exports = {
393393
Of course you can use whatever service you like or roll your own comment system. Just simply ignore the config.
394394
:::
395395

396+
## Newsletter
396397

398+
A blog newsletter is an email to notify subscribers you’ve published a new blog post. Emails are a great way to build relationships and engage with your readers.
399+
400+
Just like [Comment](#comment), we integrate a service to help you accomplish it easily. [MailChimp](https://mailchimp.com/) is probably the most well-known email marketing tool. The only required config option is `endpoint`, please head [vuepress-plugin-mailchimp](https://vuepress-plugin-mailchimp.billyyyyy3320.com/#install) to see how to get your own endpoint.
401+
```js
402+
// .vuepress/config.js
403+
module.exports = {
404+
plugins: [
405+
[
406+
'@vuepress/blog',
407+
{
408+
newsletter: {
409+
// Put your endpoint, not mine.
410+
endpoint: "https://billyyyyy3320.us4.list-manage.com/subscribe/post?u=4905113ee00d8210c2004e038&id=bd18d40138"
411+
},
412+
},
413+
],
414+
],
415+
}
416+
```
397417
## Writing a blog theme
398418

399419
If everything is ok, you can start to write a blog theme. Actually, there are only 2 necessary layout components to
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
title: `ULIVZ`,
3+
plugins: [
4+
[require('../../../lib/node'), {
5+
directories: [
6+
{
7+
id: 'post',
8+
dirname: '_posts',
9+
path: '/',
10+
},
11+
],
12+
frontmatters: [
13+
{
14+
id: "tag",
15+
keys: ['tag', 'tags'],
16+
path: '/tag/',
17+
frontmatter: { title: 'Tag' },
18+
},
19+
{
20+
id: "location",
21+
keys: ['location'],
22+
path: '/location/',
23+
frontmatter: { title: 'Location' },
24+
}
25+
],
26+
newsletter: {
27+
endpoint: "https://billyyyyy3320.us4.list-manage.com/subscribe/post?u=4905113ee00d8210c2004e038&id=bd18d40138"
28+
},
29+
}],
30+
],
31+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<ul id="default-layout">
3+
<li v-for="item in $frontmatterKey.list">
4+
<router-link class="page-link" :to="item.path">{{ item.name }}</router-link>
5+
</li>
6+
</ul>
7+
</template>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<div id="global-layout">
3+
<header style="background-color: #DDD">
4+
<router-link to="/">Home</router-link
5+
<router-link to="/tag/">Tag</router-link
6+
<router-link to="/location/">Location</router-link>
7+
</header>
8+
<DefaultGlobalLayout/>
9+
<footer style="background-color: #DDD">Powered by VuePress</footer>
10+
</div>
11+
</template>
12+
13+
<script>
14+
import GlobalLayout from '@app/components/GlobalLayout.vue'
15+
16+
export default {
17+
components: { DefaultGlobalLayout: GlobalLayout },
18+
created() {
19+
console.log()
20+
}
21+
}
22+
</script>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>
3+
<ul id="default-layout">
4+
<li v-for="page in $pagination.pages">
5+
<router-link class="page-link" :to="page.path">{{ page.title }}</router-link>
6+
</li>
7+
</ul>
8+
<div id="pagination">
9+
<router-link v-if="$pagination.hasPrev" :to="$pagination.prevLink">Prev</router-link>
10+
<router-link v-if="$pagination.hasNext" :to="$pagination.nextLink">Next</router-link>
11+
</div>
12+
13+
<Pagination v-if="$pagination.length > 1"/>
14+
</div>
15+
</template>
16+
17+
<script>
18+
import { Pagination } from '../../../../../lib/client/components.js'
19+
20+
export default {
21+
components: { Pagination },
22+
created() {},
23+
}
24+
</script>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div>
3+
<Content />
4+
<SimpleNewsletter />
5+
</div>
6+
7+
</template>
8+
9+
<script>
10+
import SimpleNewsletter from "vuepress-plugin-mailchimp/src/components/SimpleNewsletter";
11+
export default {
12+
components: {
13+
SimpleNewsletter
14+
}
15+
};
16+
</script>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
date: 2018-11-7
3+
tag:
4+
- frontmatter
5+
- vuepress
6+
author: ULIVZ
7+
location: Hangzhou
8+
---
9+
10+
# Front Matter in VuePress
11+
12+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
date: 2019-2-26
3+
tag:
4+
- markdown
5+
- vuepress
6+
author: ULIVZ
7+
location: Hangzhou
8+
---
9+
10+
# Markdown Slot
11+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
date: 2019-5-6
3+
tag:
4+
- theme
5+
- blog
6+
- vuepress
7+
author: ULIVZ
8+
location: Shanghai
9+
---
10+
11+
# Writing a VuePress theme
12+

0 commit comments

Comments
 (0)