Skip to content
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

ftd.app-path function #2057

Merged
merged 7 commits into from
Jan 29, 2025
Merged

ftd.app-path function #2057

merged 7 commits into from
Jan 29, 2025

Conversation

siddhantk232
Copy link
Contributor

This function let's ftd files inside a mounted package construct urls
that are relative to the mountpoint of the said package.

This helps fastn.app mounts to easily construct paths without assuming
(or enforcing) their mountpoints.

Calling ftd.app-path(path = /test/) in an ftd file of a mounted app will return the path
prefixed with the mountpoint of the app.

The path arg must start with a forward slash (/).

Calling this from any .ftd file of the root package will simply return the provided path argument.

Example

-- import: fastn
                                                                                            
-- fastn.package: test
                                                                                            
-- fastn.app: Test
mountpoint: /app/
package: some-test-app.fifthtry.site
                                                                                            
-- ftd.text: $ftd.app-path(path = /test/)

Visiting /app/ in browser should render /app/test/

This function let's ftd files inside a mounted package construct urls
that are relative to the mountpoint of the said package.

This helps `fastn.app` mounts to easily construct paths without assuming
(or enforcing) their mountpoints.
Add instructions on how to use the newly added `ftd.app-path` function.
@siddhantk232 siddhantk232 requested a review from amitu January 28, 2025 12:50
ftd/src/interpreter/main.rs Outdated Show resolved Hide resolved
@amitu
Copy link
Contributor

amitu commented Jan 28, 2025

@siddhantk232 also do the version number bump as we want to create a release right after merging this PR.

ftd/src/interpreter/main.rs Outdated Show resolved Hide resolved
fastn-core/src/doc.rs Outdated Show resolved Hide resolved
@amitu amitu merged commit fd19293 into main Jan 29, 2025
1 check passed
@amitu amitu deleted the feat/app-path branch January 29, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants