Skip to content

Commit

Permalink
post filename
Browse files Browse the repository at this point in the history
  • Loading branch information
io3uokljs committed Mar 11, 2024
1 parent e16aeff commit 5adb76c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tina/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ export default defineConfig({
match: {
include: "**/*",
},
ui: {
filename: {
// if disabled, the editor can not edit the filename
readonly: true,
// Example of using a custom slugify function
slugify: (values) => {
// Values is an object containing all the values of the form. In this case it is {title?: string, topic?: string}
return `${values?.date?.substring(0,10)}-${values?.title
?.toLowerCase()
.replace(/ /g, '-').replace(/å|ä/g, 'a').replace(/ö/g, 'o')}`
},
},
},
fields: [
{
type: "string",
Expand Down
1 change: 1 addition & 0 deletions tina/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export function newsFields() {
name: "lang",
label: "Language",
options: ["sv", "en"],
required: true,
},
{
type: "datetime",
Expand Down
2 changes: 1 addition & 1 deletion tina/tina-lock.json

Large diffs are not rendered by default.

0 comments on commit 5adb76c

Please sign in to comment.