diff --git a/example/.vuepress/config.js b/example/.vuepress/config.js index bff1a47..67d2f21 100644 --- a/example/.vuepress/config.js +++ b/example/.vuepress/config.js @@ -77,6 +77,9 @@ module.exports = { author: 'reco_luan', // 备案号 record: 'xxxx', + recordLink: 'http://www.baidu.com', + cyberSecurityRecord: '2222', + cyberSecurityLink: 'http://www.baidu.com', // 项目开始时间 startYear: '2017', /** diff --git a/example/views/category1/2019/092101.md b/example/views/category1/2019/092101.md index 422db9f..0a546f0 100644 --- a/example/views/category1/2019/092101.md +++ b/example/views/category1/2019/092101.md @@ -1,6 +1,6 @@ --- title: sidebar test1111 -date: '2021-01-24 20:07:41' +date: '2021/01/24' pageClass: 'customClass customClass2' sidebarDepth: 5 tags: @@ -9,6 +9,8 @@ categories: - category1 --- +# sidebar test1111 + ## 二级标题1 ### 三级标题1-1 diff --git a/example/views/sidebar/bar1.md b/example/views/sidebar/bar1.md index b2f7223..be7fc45 100644 --- a/example/views/sidebar/bar1.md +++ b/example/views/sidebar/bar1.md @@ -1,5 +1,6 @@ --- title: bar1 +publish: false --- bar1 \ No newline at end of file diff --git a/packages/vuepress-reco.github.io b/packages/vuepress-reco.github.io index c62fecf..806a0a0 160000 --- a/packages/vuepress-reco.github.io +++ b/packages/vuepress-reco.github.io @@ -1 +1 @@ -Subproject commit c62fecfa23d8897be21eb5f56150033bb55e4da4 +Subproject commit 806a0a07478490a95f1efa3d410be2d60dfd8532 diff --git a/packages/vuepress-theme-reco/components/PageInfo.vue b/packages/vuepress-theme-reco/components/PageInfo.vue index 58d2e20..39bbaa2 100644 --- a/packages/vuepress-theme-reco/components/PageInfo.vue +++ b/packages/vuepress-theme-reco/components/PageInfo.vue @@ -10,7 +10,7 @@ v-if="pageInfo.frontmatter.date" icon="reco-date" > - {{ pageInfo.frontmatter.date | formatDateValue }} + {{ formatDateValue(pageInfo.frontmatter.date) }} { + return new Intl.DateTimeFormat(instance.$lang).format(new Date(value)) } + + return { numStyle, goTags, formatDateValue } } }) diff --git a/packages/vuepress-theme-reco/helpers/postData.js b/packages/vuepress-theme-reco/helpers/postData.js index 13c3f35..e36836a 100644 --- a/packages/vuepress-theme-reco/helpers/postData.js +++ b/packages/vuepress-theme-reco/helpers/postData.js @@ -8,7 +8,7 @@ export function filterPosts (posts, isTimeline) { if (posts.indexOf(item) !== index) { return false } else { - const someConditions = home == true || title == undefined || publish === false + const someConditions = home === true || title == undefined || publish === false const boo = isTimeline === true ? !(someConditions || date === undefined) : !someConditions diff --git a/packages/vuepress-theme-reco/helpers/utils.js b/packages/vuepress-theme-reco/helpers/utils.js index 35db33c..eea2aed 100644 --- a/packages/vuepress-theme-reco/helpers/utils.js +++ b/packages/vuepress-theme-reco/helpers/utils.js @@ -199,12 +199,16 @@ export function formatDate (time, fmt = 'yyyy-MM-dd hh:mm:ss') { // 获取时间的数字类型 export function getTimeNum (date) { - return new Date(date.frontmatter.date).getTime() + const dateNum = !date ? 0 : new Date(date).getTime() + return dateNum } // 比对时间 export function compareDate (a, b) { - return getTimeNum(b) - getTimeNum(a) + const aDateNum = getTimeNum(a.frontmatter.date) + const bDateNum = getTimeNum(b.frontmatter.date) + if (aDateNum === 0 || bDateNum === 0) return 0 + return bDateNum - aDateNum } // 向 head 中添加 style diff --git a/packages/vuepress-theme-reco/mixins/posts.js b/packages/vuepress-theme-reco/mixins/posts.js index d248cee..f153b42 100644 --- a/packages/vuepress-theme-reco/mixins/posts.js +++ b/packages/vuepress-theme-reco/mixins/posts.js @@ -3,13 +3,8 @@ import { filterPosts, sortPostsByStickyAndDate, sortPostsByDate } from '../helpe export default { computed: { $recoPosts () { - const { - $categories: { list: articles } - } = this - - let posts = articles.reduce((allData, currentData) => { - return [...allData, ...currentData.pages] - }, []) + console.log(this.$site.pages) + let posts = this.$site.pages posts = filterPosts(posts, false) sortPostsByStickyAndDate(posts)