Small stuff (#69)

* refactor Title

refactor title component

* featureSlice: nicer max-width

* add meta title to news

* plugins as toml, no plugin sub-pages

fixup toml

* plugins: better letter if no icon present

* add more plugins to showcase

* fix blur script
This commit is contained in:
VDawg 2024-09-08 20:11:28 +03:00 committed by GitHub
parent 33ae9677a1
commit 4795b5d761
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 23 deletions

View file

@ -21,17 +21,23 @@ const filePaths = await globby(imageDirectories, {
extensions: ['svg', 'webp', 'jpg', 'png', 'gif', 'bmp', 'jpeg']
},
gitignore: false
}).then((filePaths) => {
const fileNames = filePaths.map(getFileNameWithoutExtension)
}).then((filePaths) =>
filePaths
.filter((filePath) => {
const isGenerated = getFileNameWithoutExtension(filePath).startsWith(generatedPrefix)
return filePaths
.filter(
(file) =>
!getFileNameWithoutExtension(file).startsWith(generatedPrefix) &&
!fileNames.includes(generatedPrefix + getFileNameWithoutExtension(file))
)
if (isGenerated) return false
const fileName = getFileNameWithoutExtension(filePath)
const fileDirectory = filePath.split('/').slice(0, -2).join('/') + '/'
const generatedFilePath = `${fileDirectory}${generatedPrefix}${fileName}.webp`
const isAlreadyBlurred = filePaths.includes(generatedFilePath)
return !isAlreadyBlurred
})
.map((filePath) => new URL(filePath, root))
})
)
for (const filePathUrl of filePaths) {
const extension = filePathUrl.pathname.split('.').at(-1)

View file

@ -2,23 +2,16 @@ import { json } from '@sveltejs/kit'
import path from 'path'
import { parse } from 'smol-toml'
import { readFile } from 'node:fs/promises'
import pluginsToml from '../../../content/plugins.toml?raw'
/** Get the plugins of the `content/plugins/` directory */
async function getPlugins() {
const plugins = await readFile(
path.join(import.meta.dirname, '../../../content/plugins.toml'),
'utf-8'
)
.then(parse)
.then(({ plugins }) =>
plugins.sort(
const plugins = parse(pluginsToml).plugins.sort(
(a, b) =>
(b.featured ?? 0) - (a.featured ?? 0) ||
(b.weight ?? 0) - (a.weight ?? 0) ||
((b.logo && 1) ?? 0) - ((a.logo && 1) ?? 0) ||
((b.banner && 1) ?? 0) - ((a.banner && 1) ?? 0)
)
)
return plugins
}