From 10dd8d30676e9bc7afe8055dbd15508ffe8a1edc Mon Sep 17 00:00:00 2001 From: iMaeGoo Date: Wed, 12 Jul 2023 10:34:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(view):=20cannot=20specify=20=E2=80=9Ctype?= =?UTF-8?q?=E2=80=9D=20of=20archives=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/widget/archives.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/view/widget/archives.jsx b/src/view/widget/archives.jsx index 429030d1..0ff2251d 100644 --- a/src/view/widget/archives.jsx +++ b/src/view/widget/archives.jsx @@ -77,14 +77,14 @@ class Archives extends Component { * url_for: function() {...}, * _p: function() {...} * }} - * type="monthly" + * group_by="monthly" * order={-1} * showCount={true} * format="MMMM YYYY" /> */ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', (props) => { const { site, config, page, helper, widget } = props; - const { type = 'monthly', order = -1, showCount = true, format = null } = widget; + const { group_by = 'monthly', order = -1, showCount = true, format = null } = widget; const { url_for, _p } = helper; const posts = site.posts.sort('date', order); @@ -110,7 +110,7 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', (props) => { const year = date.year(); const month = date.month() + 1; - const name = date.format(format || (type === 'monthly' ? 'MMMM YYYY' : 'YYYY')); + const name = date.format(format || (group_by === 'monthly' ? 'MMMM YYYY' : 'YYYY')); const lastData = data[length - 1]; if (!lastData || lastData.name !== name) { @@ -128,7 +128,7 @@ Archives.Cacheable = cacheComponent(Archives, 'widget.archives', (props) => { const link = (item) => { let url = `${config.archive_dir}/${item.year}/`; - if (type === 'monthly') { + if (group_by === 'monthly') { if (item.month < 10) url += '0'; url += `${item.month}/`; }