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

Commit ea6602f

Browse files
fix: web feed link 404 when set custom base (#104)
Co-authored-by: Billyyyyy3320 <[email protected]>
1 parent 0dc4d5f commit ea6602f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

components/Feed.vue

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<template>
2-
<a
3-
v-if="getFirstEnabledFeed"
4-
class="feed"
5-
:href="getFirstEnabledFeed | getFeedFilePath"
6-
>
2+
<a v-if="firstEnabledFeed" class="feed" :href="feedFilePath">
73
<RssIcon />
84
</a>
95
</template>
@@ -13,22 +9,25 @@ import { RssIcon } from 'vue-feather-icons'
139
1410
export default {
1511
components: { RssIcon },
16-
filters: {
17-
getFeedFilePath(feed) {
18-
if (feed === 'rss') return '/rss.xml'
19-
if (feed === 'atom') return '/feed.atom'
20-
if (feed === 'json') return '/feed.json'
21-
return ''
22-
},
23-
},
12+
2413
computed: {
25-
getFirstEnabledFeed() {
14+
firstEnabledFeed() {
2615
for (const feed in this.$service.feed) {
2716
const isEnabled = this.$service.feed[feed]
2817
if (isEnabled) return feed
2918
}
3019
return false
3120
},
21+
feedFilePath() {
22+
if (!this.firstEnabledFeed) return
23+
24+
let path = ''
25+
if (this.firstEnabledFeed === 'rss') path = '/rss.xml'
26+
if (this.firstEnabledFeed === 'atom') path = '/feed.atom'
27+
if (this.firstEnabledFeed === 'json') path = '/feed.json'
28+
29+
return this.$withBase(path)
30+
},
3231
},
3332
}
3433
</script>

0 commit comments

Comments
 (0)