mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-05 07:26:46 +00:00
Merge pull request #387 from haixin1225/footer-copyright-date-fix
fix: issue when BLOG.SINCE is current year
This commit is contained in:
@@ -4,13 +4,18 @@ import DarkModeButton from '@/components/DarkModeButton'
|
|||||||
export const Footer = (props) => {
|
export const Footer = (props) => {
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const currentYear = d.getFullYear()
|
const currentYear = d.getFullYear()
|
||||||
const startYear = BLOG.SINCE && BLOG.SINCE !== currentYear && BLOG.SINCE + '-'
|
const copyrightDate = (function() {
|
||||||
|
if (Number.isInteger(BLOG.SINCE) && BLOG.SINCE < currentYear) {
|
||||||
|
return BLOG.SINCE + '-' + currentYear
|
||||||
|
}
|
||||||
|
return currentYear
|
||||||
|
})()
|
||||||
|
|
||||||
return <footer className="w-full bg-white px-6 border-t dark:border-hexo-black-gray dark:bg-hexo-black-gray ">
|
return <footer className="w-full bg-white px-6 border-t dark:border-hexo-black-gray dark:bg-hexo-black-gray ">
|
||||||
<DarkModeButton className='text-center pt-4'/>
|
<DarkModeButton className='text-center pt-4'/>
|
||||||
|
|
||||||
<div className="container mx-auto max-w-4xl py-6 md:flex flex-wrap md:flex-no-wrap md:justify-between items-center text-sm">
|
<div className="container mx-auto max-w-4xl py-6 md:flex flex-wrap md:flex-no-wrap md:justify-between items-center text-sm">
|
||||||
<div className='text-center'> ©{`${startYear}${currentYear}`} {BLOG.AUTHOR}. All rights reserved.</div>
|
<div className='text-center'> ©{`${copyrightDate}`} {BLOG.AUTHOR}. All rights reserved.</div>
|
||||||
<div className="md:p-0 text-center md:text-right text-xs">
|
<div className="md:p-0 text-center md:text-right text-xs">
|
||||||
{/* 右侧链接 */}
|
{/* 右侧链接 */}
|
||||||
{/* <a href="#" className="text-black no-underline hover:underline">Privacy Policy</a> */}
|
{/* <a href="#" className="text-black no-underline hover:underline">Privacy Policy</a> */}
|
||||||
|
|||||||
@@ -3,12 +3,18 @@ import BLOG from '@/blog.config'
|
|||||||
function SiteInfo ({ title }) {
|
function SiteInfo ({ title }) {
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const currentYear = d.getFullYear()
|
const currentYear = d.getFullYear()
|
||||||
const startYear = BLOG.SINCE && BLOG.SINCE !== currentYear && BLOG.SINCE + '-'
|
const copyrightDate = (function() {
|
||||||
|
if (Number.isInteger(BLOG.SINCE) && BLOG.SINCE < currentYear) {
|
||||||
|
return BLOG.SINCE + '-' + currentYear
|
||||||
|
}
|
||||||
|
return currentYear
|
||||||
|
})()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer
|
<footer
|
||||||
className='leading-6 justify-start w-full text-gray-400 text-xs font-sans'
|
className='leading-6 justify-start w-full text-gray-400 text-xs font-sans'
|
||||||
>
|
>
|
||||||
<span> © {`${startYear}${currentYear}`} <span> <a href={BLOG.LINK} className='text-gray-500 dark:text-gray-300 '> <i className='mx-1 animate-pulse fas fa-heart'/> {BLOG.AUTHOR}</a>. <br /></span>
|
<span> © {`${copyrightDate}`} <span> <a href={BLOG.LINK} className='text-gray-500 dark:text-gray-300 '> <i className='mx-1 animate-pulse fas fa-heart'/> {BLOG.AUTHOR}</a>. <br /></span>
|
||||||
|
|
||||||
{BLOG.BEI_AN && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br/></>}
|
{BLOG.BEI_AN && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br/></>}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,20 @@ import DarkModeButton from '@/components/DarkModeButton'
|
|||||||
const Footer = ({ title }) => {
|
const Footer = ({ title }) => {
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const currentYear = d.getFullYear()
|
const currentYear = d.getFullYear()
|
||||||
const startYear = BLOG.SINCE && BLOG.SINCE !== currentYear && BLOG.SINCE + '-'
|
const copyrightDate = (function() {
|
||||||
|
if (Number.isInteger(BLOG.SINCE) && BLOG.SINCE < currentYear) {
|
||||||
|
return BLOG.SINCE + '-' + currentYear
|
||||||
|
}
|
||||||
|
return currentYear
|
||||||
|
})()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer
|
<footer
|
||||||
className='font-sans dark:bg-black flex-shrink-0 bg-hexo-light-gray justify-center text-center m-auto w-full leading-6 text-gray-600 dark:text-gray-100 text-sm p-6'
|
className='font-sans dark:bg-black flex-shrink-0 bg-hexo-light-gray justify-center text-center m-auto w-full leading-6 text-gray-600 dark:text-gray-100 text-sm p-6'
|
||||||
>
|
>
|
||||||
<DarkModeButton/>
|
<DarkModeButton/>
|
||||||
|
|
||||||
<i className='fas fa-copyright' /> {`${startYear}${currentYear}`} <span><i className='mx-1 animate-pulse fas fa-heart'/> <a href={BLOG.LINK} className='underline font-bold dark:text-gray-300 '>{BLOG.AUTHOR}</a>.<br/>
|
<i className='fas fa-copyright' /> {`${copyrightDate}`} <span><i className='mx-1 animate-pulse fas fa-heart'/> <a href={BLOG.LINK} className='underline font-bold dark:text-gray-300 '>{BLOG.AUTHOR}</a>.<br/>
|
||||||
|
|
||||||
{BLOG.BEI_AN && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br/></>}
|
{BLOG.BEI_AN && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br/></>}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,19 @@ import DarkModeButton from '@/components/DarkModeButton'
|
|||||||
const Footer = ({ title }) => {
|
const Footer = ({ title }) => {
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const currentYear = d.getFullYear()
|
const currentYear = d.getFullYear()
|
||||||
const startYear = BLOG.SINCE && BLOG.SINCE !== currentYear && BLOG.SINCE + '-'
|
const copyrightDate = (function() {
|
||||||
|
if (Number.isInteger(BLOG.SINCE) && BLOG.SINCE < currentYear) {
|
||||||
|
return BLOG.SINCE + '-' + currentYear
|
||||||
|
}
|
||||||
|
return currentYear
|
||||||
|
})()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer
|
<footer
|
||||||
className='dark:bg-hexo-black-gray flex-shrink-0 justify-center text-center m-auto w-full leading-6 text-gray-400 text-sm p-6'
|
className='dark:bg-hexo-black-gray flex-shrink-0 justify-center text-center m-auto w-full leading-6 text-gray-400 text-sm p-6'
|
||||||
>
|
>
|
||||||
<DarkModeButton/>
|
<DarkModeButton/>
|
||||||
<i className='fas fa-copyright' /> {`${startYear}${currentYear}`} <span><i className='mx-1 animate-pulse fas fa-heart'/> <a href={BLOG.LINK} className='underline font-bold text-gray-500 dark:text-gray-300 '>{BLOG.AUTHOR}</a>.<br/>
|
<i className='fas fa-copyright' /> {`${copyrightDate}`} <span><i className='mx-1 animate-pulse fas fa-heart'/> <a href={BLOG.LINK} className='underline font-bold text-gray-500 dark:text-gray-300 '>{BLOG.AUTHOR}</a>.<br/>
|
||||||
|
|
||||||
{BLOG.BEI_AN && <><i className='fas fa-shield-alt'/> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br/></>}
|
{BLOG.BEI_AN && <><i className='fas fa-shield-alt'/> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br/></>}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,20 @@ import DarkModeButton from '@/components/DarkModeButton'
|
|||||||
const Footer = ({ title }) => {
|
const Footer = ({ title }) => {
|
||||||
const d = new Date()
|
const d = new Date()
|
||||||
const currentYear = d.getFullYear()
|
const currentYear = d.getFullYear()
|
||||||
const startYear = BLOG.SINCE && BLOG.SINCE !== currentYear && BLOG.SINCE + '-'
|
const copyrightDate = (function() {
|
||||||
|
if (Number.isInteger(BLOG.SINCE) && BLOG.SINCE < currentYear) {
|
||||||
|
return BLOG.SINCE + '-' + currentYear
|
||||||
|
}
|
||||||
|
return currentYear
|
||||||
|
})()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer
|
<footer
|
||||||
className='dark:bg-gray-900 flex-shrink-0 justify-center text-center m-auto w-full leading-6 text-sm p-6 dark:text-gray-400'
|
className='dark:bg-gray-900 flex-shrink-0 justify-center text-center m-auto w-full leading-6 text-sm p-6 dark:text-gray-400'
|
||||||
>
|
>
|
||||||
<DarkModeButton/>
|
<DarkModeButton/>
|
||||||
<span>
|
<span>
|
||||||
<i className='fas fa-copyright' /> {`${startYear}${currentYear}`} <span className='mx-1 animate-pulse'><i className='fas fa-heart' /></span> <a href={BLOG.LINK} className='underline font-bold '>{BLOG.AUTHOR}</a>.<br />
|
<i className='fas fa-copyright' /> {`${copyrightDate}`} <span className='mx-1 animate-pulse'><i className='fas fa-heart' /></span> <a href={BLOG.LINK} className='underline font-bold '>{BLOG.AUTHOR}</a>.<br />
|
||||||
|
|
||||||
{BLOG.BEI_AN && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br /></>}
|
{BLOG.BEI_AN && <><i className='fas fa-shield-alt' /> <a href='https://beian.miit.gov.cn/' className='mr-2'>{BLOG.BEI_AN}</a><br /></>}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user