Skip to content

Commit

Permalink
feat: support saber 0.5
Browse files Browse the repository at this point in the history
BREAKING CHANGE: require saber 0.5 or above
  • Loading branch information
egoist committed May 8, 2019
1 parent aa7a53a commit 20acb8c
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 132 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ theme: minima
This theme is better working with following plugins:
- `saber-plugin-query-posts`: Inject `posts` to homepage's `page` prop, generate tag pages
- `saber-plugin-generate-feed`: Generate JSON feed at `/feed.json`.
- `saber-plugin-feed`: Generate feed.

```bash
yarn add saber-plugin-query-posts saber-plugin-generate-feed
Expand All @@ -28,7 +28,7 @@ yarn add saber-plugin-query-posts saber-plugin-generate-feed
```yml
plugins:
- resolve: saber-plugin-query-posts
- resolve: saber-plugin-generate-feed
- resolve: saber-plugin-feed
options:
atomFeed: true
```
Expand Down
2 changes: 1 addition & 1 deletion example/saber-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ themeConfig:

plugins:
- resolve: saber-plugin-query-posts
- resolve: saber-plugin-generate-feed
- resolve: saber-plugin-feed
options:
atomFeed: true
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
"generate:example": "saber generate example"
},
"devDependencies": {
"saber": "^0.3.4",
"saber-plugin-generate-feed": "^0.1.1",
"saber-plugin-query-posts": "^0.0.7",
"saber": "^0.5.0",
"saber-plugin-feed": "^0.3.0",
"saber-plugin-query-posts": "^0.2.0",
"sass": "^1.17.3",
"sass-loader": "^7.1.0",
"vue-compile": "^0.5.1"
},
"dependencies": {
"tinydate": "^1.0.1"
},
"peerDependencies": {
"saber": "^0.5.0"
},
"keywords": [
"saber",
"saber-theme",
Expand Down
11 changes: 2 additions & 9 deletions src/components/Social.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
</svg>
</a>
</li>
<li v-if="social.rss && feedLink">
<a :href="feedLink" title="rss">
<li v-if="social.rss && $feed">
<a :href="$feed.permalink" title="rss">
<svg class="svg-icon grey">
<use :xlink:href="getSvg('rss')"></use>
</svg>
Expand All @@ -95,16 +95,9 @@
</template>

<script>
import variables from 'saber/variables'
import getSvg from '../utils/getSvg'
export default {
data() {
return {
feedLink: variables.feedLink
}
},
computed: {
social() {
return this.$themeConfig.social
Expand Down
8 changes: 4 additions & 4 deletions src/components/Wrap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export default {
content: description
}
].filter(Boolean),
link: variables.feedLink
link: this.$feed
? [
{
rel: 'alternate',
title: `${this.siteTitle} - Feed`,
type: `application/${
variables.feedLinkType === 'atom'
this.$feed.type === 'atom'
? 'atom+xml'
: variables.feedLinkType === 'rss'
: this.$feed.type === 'rss'
? 'rss+xml'
: 'json'
}`,
href: variables.feedLink
href: this.$feed.permalink
}
].filter(Boolean)
: []
Expand Down
11 changes: 2 additions & 9 deletions src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@
>Next →</router-link>
</div>

<p class="feed-subscribe" v-if="feedLink">
<p class="feed-subscribe" v-if="$feed">
<svg class="svg-icon orange">
<use :xlink:href="getSvg('rss')"></use>
</svg>
<a :href="feedLink">Subscribe</a>
<a :href="$feed.permalink">Subscribe</a>
</p>
</div>
</Wrap>
</template>

<script>
import variables from 'saber/variables'
import formatDate from '../utils/formatDate'
import Wrap from '../components/Wrap.vue'
import getSvg from '../utils/getSvg'
Expand All @@ -61,12 +60,6 @@ export default {
props: ['page'],
data() {
return {
feedLink: variables.feedLink
}
},
methods: {
formatDate,
getSvg
Expand Down
Loading

0 comments on commit 20acb8c

Please sign in to comment.