Skip to content

Commit

Permalink
🔖 v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentDepth committed Apr 14, 2023
2 parents b937448 + b050a9d commit c0708bc
Show file tree
Hide file tree
Showing 74 changed files with 1,914 additions and 844 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-present, Craig Hart
Copyright (c) 2023-present, Osmium Project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
5 changes: 3 additions & 2 deletions assets/config-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
description: 'Lorem ipsum dolor sit amet.',
link: 'https://osmium-blog.vercel.app',
since: 2023,
footerText: '',
author: 'Osmium user',
email: '[email protected]',
socialLink: '',
Expand All @@ -15,10 +16,10 @@ module.exports = {
darkBackground: '#191919',
postsPerPage: 7,
sortByDate: false,
showAbout: true,

path: '',
ogImageGenerateURL: 'https://og-image-craigary.vercel.app',
ogImageGenerateURL: '',
rss: true,
seo: {
keywords: ['Blog', 'Website', 'Notion'],
googleSiteVerification: '',
Expand Down
Binary file added assets/fonts/NotoSansSC-Bold.otf
Binary file not shown.
Binary file added assets/fonts/NotoSerifSC-Bold.otf
Binary file not shown.
9 changes: 6 additions & 3 deletions assets/i18n/configurator/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"since": {
"description": "Site creation year"
},
"footerText": {
"description": "Site footer text. For detail usage, see <a href=\"https://osmium-blog.vercel.app/osmium-v1.1#f5c9e1c2b39a45cca68f832c1e225bc4\" target=\"_blank\">here</a>"
},
"author": {
"description": "Author name"
},
Expand Down Expand Up @@ -59,15 +62,15 @@
"sortByDate": {
"description": "Sort by date"
},
"showAbout": {
"description": "Display “About” link"
},
"path": {
"description": "Site root path. If you want to mount the site under a certain path of another site, you need to fill in this item."
},
"ogImageGenerateURL": {
"description": "OG image generation service address (don’t add a slash at the end)"
},
"rss": {
"description": "Enable RSS"
},
"seo": {
"description": "SEO configuration",
"keywords": {
Expand Down
9 changes: 6 additions & 3 deletions assets/i18n/configurator/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"since": {
"description": "站点创建年份"
},
"footerText": {
"description": "站点页脚说明文本,使用说明请见<a href=\"https://osmium-blog.vercel.app/osmium-v1.1-zh#d43e9a909bfd4bd0a0d9323317dbf48f\" target=\"_blank\">这里</a>"
},
"author": {
"description": "作者名称"
},
Expand Down Expand Up @@ -59,15 +62,15 @@
"sortByDate": {
"description": "按日期排序"
},
"showAbout": {
"description": "显示“关于”链接"
},
"path": {
"description": "站点根路径,如果你想把站点挂载到其他站点的某个路径下则需要填写此项"
},
"ogImageGenerateURL": {
"description": "OG 图像生成服务地址(结尾不要加斜线)"
},
"rss": {
"description": "启用 RSS"
},
"seo": {
"description": "SEO 配置",
"keywords": {
Expand Down
30 changes: 13 additions & 17 deletions components/Container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useConfig } from '@/lib/config'
import Head from 'next/head'
import PropTypes from 'prop-types'
import cn from 'classnames'
// import PostListItem from './PostListItem'
import { execTemplate } from '@/lib/utils'

const Container = ({ children, layout, fullWidth, ...customMeta }) => {
const BLOG = useConfig()
Expand All @@ -15,6 +15,15 @@ const Container = ({ children, layout, fullWidth, ...customMeta }) => {
type: 'website',
...customMeta,
}

const ogImageService = BLOG.ogImageGenerateURL && (
BLOG.ogImageGenerateURL === 'https://og-image-craigary.vercel.app'
// Backward compatibility
// TODO: remove in v2.0
? `${BLOG.ogImageGenerateURL}/${encodeURIComponent(meta.title)}.png?theme=dark&md=1&fontSize=125px&images=https%3A%2F%2Fnobelium.vercel.app%2Flogo-for-dark-bg.svg`
: execTemplate(BLOG.ogImageGenerateURL, { title: meta.title })
)

return (
<div>
<Head>
Expand All @@ -39,22 +48,12 @@ const Container = ({ children, layout, fullWidth, ...customMeta }) => {
property="og:url"
content={meta.slug ? `${url}/${meta.slug}` : url}
/>
<meta
property="og:image"
content={`${BLOG.ogImageGenerateURL}/${encodeURIComponent(
meta.title,
)}.png?theme=dark&md=1&fontSize=125px&images=https%3A%2F%2Fnobelium.vercel.app%2Flogo-for-dark-bg.svg`}
/>
{ogImageService && <meta property="og:image" content={ogImageService}/>}
<meta property="og:type" content={meta.type}/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:description" content={meta.description}/>
<meta name="twitter:title" content={meta.title}/>
<meta
name="twitter:image"
content={`${BLOG.ogImageGenerateURL}/${encodeURIComponent(
meta.title,
)}.png?theme=dark&md=1&fontSize=125px&images=https%3A%2F%2Fnobelium.vercel.app%2Flogo-for-dark-bg.svg`}
/>
{ogImageService && <meta name="twitter:image" content={ogImageService}/>}
{meta.type === 'article' && (
<>
<meta
Expand All @@ -69,10 +68,7 @@ const Container = ({ children, layout, fullWidth, ...customMeta }) => {
className={`wrapper ${BLOG.font === 'serif' ? 'font-serif' : 'font-sans'
}`}
>
<Header
navBarTitle={layout === 'blog' ? meta.title : null}
fullWidth={fullWidth}
/>
<Header navBarTitle={layout === 'blog' ? meta.title : undefined}/>
<main
className={cn(
'flex-grow transition-all',
Expand Down
25 changes: 0 additions & 25 deletions components/Footer.jsx

This file was deleted.

49 changes: 49 additions & 0 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useConfig } from '@/lib/config'
import { execTemplate } from '@/lib/utils'

type Props = {
fullWidth: boolean
}

/**
* The site footer
*/
export default function Footer ({ fullWidth }: Props) {
const { author, since, footerText, version } = useConfig()

let text: string
// If user defined `footerText`, use it as a template
if (footerText) {
text = execTemplate(footerText, { since })
}
// If not, generate a simple version
else {
text = ${author} ${getSinceText(since)}`
}

return (
<div
className={`mt-6 flex-shrink-0 m-auto w-full text-gray-500 dark:text-gray-400 transition-all ${
!fullWidth ? 'max-w-2xl px-4' : 'px-4 md:px-24'
}`}
>
<div className="py-4 text-sm leading-6 border-t border-gray-200 dark:border-gray-600">
<div className="flex align-baseline flex-wrap">
<span dangerouslySetInnerHTML={{ __html: text }}/>
{version && (
<span className="ml-auto text-right">
Osmium ver.&nbsp;
{/^[0-9a-f]+$/.test(version) ? <code>{version}</code> : version}
</span>
)}
</div>
</div>
</div>
)
}

function getSinceText (since: string | number): string {
since = +since
const now = new Date().getFullYear()
return Number.isNaN(since) || since === now ? String(since) : `${since} - ${now}`
}
6 changes: 4 additions & 2 deletions components/FormattedDate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dayjs.extend(localizedFormat)

const loaded = {}

export default function FormattedDate ({ date }) {
export default function FormattedDate ({ date, className }) {
const lang = useConfig().lang.slice(0, 2)
const [isLocaleLoaded, setIsLocaleLoaded] = useState(loaded[lang] === true)

Expand All @@ -25,5 +25,7 @@ export default function FormattedDate ({ date }) {

}, [isLocaleLoaded, lang])

return <span>{dayjs(date).format('ll')}</span>
const day = dayjs(date)

return <time dateTime={day.toISOString()} className={className}>{day.format('ll')}</time>
}
117 changes: 0 additions & 117 deletions components/Header.jsx

This file was deleted.

Loading

0 comments on commit c0708bc

Please sign in to comment.