-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: proxy files with custom slugs #224
base: main
Are you sure you want to change the base?
Conversation
Deploying head-start with Cloudflare Pages
|
@@ -10,5 +10,6 @@ fragment FileRoute on FileRecord { | |||
url | |||
} | |||
locale | |||
customSlug: slug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required to resolve clashing types with other slug
fields on route fragments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also be resolved when renaming the field
@@ -0,0 +1,37 @@ | |||
import { defineMiddleware } from 'astro/middleware'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the new atomic middleware handlers setup introduced in #222 . Should maybe be merged first?
…oede/head-start into feat/proxy-files-with-custom-slugs
id: 'cnnDYybJTAGvHxiYq2MJ8g', | ||
label: 'Slug', | ||
field_type: 'string', | ||
api_key: 'slug', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think naming this slug is confusing. In my perception, a slug is a human-readable, yet machine-safe path fragment. What is described in the hint, and in the customFields
function seems to show a path, not a slug
environment: datocmsEnvironment, | ||
}); | ||
|
||
const fileSlugMap = {} as FileSlugMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,5 +10,6 @@ fragment FileRoute on FileRecord { | |||
url | |||
} | |||
locale | |||
customSlug: slug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also be resolved when renaming the field
Changes
Makes files available under custom URLs by
slug
field to the File model./my-files/example.pdf
serveshttps://www.datocms-assets.com/145765/1730925112-dummy.pdf
.Associated issue
Resolves #155
How to test
Checklist