diff --git a/src/api/post.js b/src/api/post.js index 9e3f02fb..e6883b9d 100644 --- a/src/api/post.js +++ b/src/api/post.js @@ -130,6 +130,10 @@ postApi.permalinkType = { type: 'DEFAULT', text: '默认' }, + YEAR: { + type: 'YEAR', + text: '年份型' + }, DATE: { type: 'DATE', text: '年月型' diff --git a/src/utils/filter.js b/src/utils/filter.js index 5c2a7a1f..1d232c06 100644 --- a/src/utils/filter.js +++ b/src/utils/filter.js @@ -22,6 +22,10 @@ Vue.filter('moment_post_date', function(dataStr, pattern = '/YYYY/MM/') { return dayjs(dataStr).format(pattern) }) +Vue.filter('moment_post_year', function(dataStr, pattern = '/YYYY/') { + return dayjs(dataStr).format(pattern) +}) + Vue.filter('moment_post_day', function(dataStr, pattern = '/YYYY/MM/DD/') { return dayjs(dataStr).format(pattern) }) diff --git a/src/views/post/components/PostSettingDrawer.vue b/src/views/post/components/PostSettingDrawer.vue index 2fe04750..892da9ea 100644 --- a/src/views/post/components/PostSettingDrawer.vue +++ b/src/views/post/components/PostSettingDrawer.vue @@ -425,6 +425,11 @@ export default { return `${blogUrl}/${archivesPrefix}/${ this.selectedPost.slug ? this.selectedPost.slug : '{slug}' }${pathSuffix}` + case 'YEAR': + return `${blogUrl}${datetimeFormat( + this.selectedPost.createTime ? this.selectedPost.createTime : new Date(), + '/YYYY/' + )}${this.selectedPost.slug ? this.selectedPost.slug : '{slug}'}${pathSuffix}` case 'DATE': return `${blogUrl}${datetimeFormat( this.selectedPost.createTime ? this.selectedPost.createTime : new Date(), diff --git a/src/views/system/optiontabs/PermalinkTab.vue b/src/views/system/optiontabs/PermalinkTab.vue index 85fbda37..c78942f3 100644 --- a/src/views/system/optiontabs/PermalinkTab.vue +++ b/src/views/system/optiontabs/PermalinkTab.vue @@ -10,6 +10,7 @@