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

View file

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