Comments (4)
@MarvinMiles, assuming you mean the file name of the leaf component, you can try
$activeRoute.leaf.node.file
from routify.
I'm unable to replicate this on 3.0.0-next.199
and 3.0.0-next.205
.
In my src/routes/posts/index.md
:
<!-- routify:meta _test="test" -->
<script>
import {node, meta} from '@roxi/routify'
export let context
</script>
{$meta._test}
{$node.meta._test}
{context.node.meta._test}
This prints test test test
Are you by any chance trying to get the index
meta data from the posts
folder? If so, _module.svelte|md
represents the folder.
from routify.
@jakobrosenberg Thanks. Got you... almost.
So how can I get meta data of active route inside _module.svelte
file?
Got a working solution by $activeRoute.fragments[$activeRoute.fragments.length-1].node.meta
, but this looks ugly and overheady.
Use case would be managing <svelte:head>
inside _module file.
For example:
<svelte:head>
<title>{ $activeNode.title }</title>
<meta content="{ $activeNode.meta.description }" name="description" />
</svelte:head>
from routify.
Ok $activeRoute.meta
solves the issue.
Yet how can I get title (file name) of activeRoute?
from routify.
Related Issues (20)
- Compatibility with Vite 5 HOT 2
- v3: derived helpers became broken after svelte migration from 3.x to 4.x HOT 3
- TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function HOT 4
- Add Routify config option to preserve/strip/force the trailing slash on urls
- v3: Setting meta `title` value cause console warning HOT 2
- vite-plugin-svelte: missing exports condition warning (Routify 2.18.12) HOT 7
- Using metadata indirectly (via variable) makes goto to not work properly. HOT 5
- [Bug][Doc][v3] Invalid Url Rewrites example HOT 4
- [Bug][V3] Routify renders 404 a fraction of second when using URLRewrite HOT 10
- Vite build: missing specifier (^2.18.13) HOT 3
- Suggestion: Allow ts extension in meta files HOT 3
- After upgrading to 2.18.13 './plugins/rollup' is not defined by "exports" HOT 4
- Anchors / scroll into view HOT 3
- Update peerDependencies to prevent `npm install` conflicts HOT 5
- Make killWarnings.js more resilient HOT 1
- Routify hangs with vitest HOT 10
- Support svelte 5
- Routing priority HOT 1
- I Just thinking aloud, URL rewrite options should be part of AddressReflector HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routify.