Skip to content

Instantly share code, notes, and snippets.

View scottgallant's full-sized avatar

Scott Gallant scottgallant

View GitHub Profile
@scottgallant
scottgallant / config.ts
Created June 14, 2023 01:51
TinaCMS: prepend filename with date upon creation
const schema = defineSchema({
collections: [
{
name: "post",
label: "Posts",
path: "site/content/posts",
ui: {
filename: {
slugify: values => {
const postDate = values.date ? new Date(values.date) : new Date();
<!-- https://icons.getbootstrap.com/ -->
<a href="/" class="icon">
<!-- RSS -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2zm0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2zm.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z" />
</svg>
</a>