A route group in SvelteKit is a folder in the routes directory that groups related routes together without adding extra URL segments. It helps organize routes without changing the URL structure.
Click to reveal answer
beginner
How do you create a route group in SvelteKit?
You create a route group by wrapping a folder name in parentheses, like (group-name). This folder can contain route files or other folders, but it won't add to the URL path.
Click to reveal answer
intermediate
Why use route groups instead of normal folders in SvelteKit?
Route groups help keep your routes organized without changing the URL. Normal folders add to the URL path, but route groups do not, so they keep URLs clean while grouping related pages.
Click to reveal answer
intermediate
Can route groups be nested inside each other in SvelteKit?
Yes, route groups can be nested. You can have folders like (group1)/(group2)/page.svelte to organize routes deeply without affecting the URL path.
Click to reveal answer
beginner
Does a route group folder in SvelteKit affect the URL path?
No, route group folders do not affect the URL path. They are only for organizing files and routes internally, so the URL stays the same as if the group folder wasn't there.
Click to reveal answer
How do you mark a folder as a route group in SvelteKit?
APrefix the folder name with an underscore
BAdd a special config file inside the folder
CWrap the folder name in parentheses
DUse a dot before the folder name
✗ Incorrect
In SvelteKit, route groups are created by wrapping the folder name in parentheses, like (group).
What happens to the URL path when you use a route group folder?
AThe folder name appears in the URL
BThe URL path becomes invalid
CThe URL path is removed
DThe URL path stays the same, no change
✗ Incorrect
Route groups do not add to the URL path; they only organize routes internally.
Can you nest route groups inside other route groups in SvelteKit?
ANo, nesting is not allowed
BYes, nesting is allowed
COnly one level of nesting is allowed
DNesting requires special configuration
✗ Incorrect
SvelteKit allows nesting route groups by placing folders with parentheses inside each other.
Why might you use route groups in a SvelteKit project?
ATo organize routes without changing URLs
BTo disable routing for some pages
CTo add extra URL segments
DTo create API endpoints
✗ Incorrect
Route groups help keep routes organized without affecting the URL structure.
Which of these folder names is a valid route group in SvelteKit?
A(admin)
Buser-profile
C_settings
D.hidden
✗ Incorrect
Only folders with names wrapped in parentheses, like (admin), are route groups.
Explain what a route group is in SvelteKit and why it is useful.
Think about how you keep your files tidy without changing how users see the website address.
You got /4 concepts.
Describe how nesting route groups works and what effect it has on URLs.
Imagine folders inside folders that don't show up in the website address.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using route groups in a SvelteKit project?
easy
A. To change the URL path of routes automatically
B. To add styles to routes
C. To organize routes without changing the URL structure
D. To create API endpoints
Solution
Step 1: Understand route groups concept
Route groups in SvelteKit are folders with parentheses that help organize routes.
Step 2: Identify effect on URL
Route groups do not affect the URL path; they only organize files internally.
Final Answer:
To organize routes without changing the URL structure -> Option C
Quick Check:
Route groups = organize routes, no URL change [OK]
Hint: Remember: parentheses folders group routes but keep URLs same [OK]
Common Mistakes:
Thinking route groups change URLs
Confusing route groups with styling
Assuming route groups create API endpoints
2. Which folder name correctly creates a route group in SvelteKit?
easy
A. (admin)
B. user_profile
C. blog(posts)
D. [settings]
Solution
Step 1: Identify route group syntax
Route groups use parentheses around folder names, like (group).
Step 2: Check options
Only (admin) uses parentheses correctly: (admin).
Final Answer:
(admin) -> Option A
Quick Check:
Parentheses folder = route group [OK]
Hint: Look for folder names wrapped in parentheses [OK]
What will be the URL path to access the stats page?
medium
A. /(dashboard)/stats
B. /stats
C. /stats/dashboard
D. /dashboard/stats
Solution
Step 1: Understand route groups effect on URL
Folders in parentheses do not appear in the URL path.
Step 2: Determine URL for stats page
The stats folder is inside the group, so URL is just /stats.
Final Answer:
/stats -> Option B
Quick Check:
Route groups hide folder name in URL [OK]
Hint: Ignore parentheses folders when reading URLs [OK]
Common Mistakes:
Including group folder name in URL
Confusing parentheses with URL segments
Assuming group name appears in URL
4. You created a folder named (admin) inside src/routes but your routes inside it are not working. What is a likely cause?
medium
A. You forgot to add a +page.svelte file inside the group folder
B. Parentheses are not allowed in folder names
C. Route groups must be named with square brackets
D. You need to restart the server after creating route groups
Solution
Step 1: Check route group folder requirements
Route groups organize routes but need actual route files like +page.svelte inside.
Step 2: Identify missing file issue
If no +page.svelte or route file exists, routes won't work.
Final Answer:
You forgot to add a +page.svelte file inside the group folder -> Option A
Quick Check:
Route groups need route files to work [OK]
Hint: Always add +page.svelte inside route groups [OK]
Common Mistakes:
Thinking parentheses folders are invalid
Using wrong bracket types
Assuming server restart fixes missing files
5. You want to group routes for profile and settings under a common group without changing their URLs. Which folder structure achieves this correctly?
hard
A. src/routes/(user-profile-settings)/+page.svelte
B. src/routes/user/profile/+page.svelte and src/routes/user/settings/+page.svelte
C. src/routes/[user]/profile/+page.svelte and src/routes/[user]/settings/+page.svelte
D. src/routes/(user)/profile/+page.svelte and src/routes/(user)/settings/+page.svelte
Solution
Step 1: Understand grouping without URL change
Route groups use parentheses folders to group routes without affecting URLs.
Step 2: Analyze folder structures
src/routes/(user)/profile/+page.svelte and src/routes/(user)/settings/+page.svelte uses (user) folder to group profile and settings routes without adding /user to URLs.
Final Answer:
src/routes/(user)/profile/+page.svelte and src/routes/(user)/settings/+page.svelte -> Option D
Quick Check:
Parentheses folder groups routes, no URL change [OK]
Hint: Use parentheses folders to group routes invisibly [OK]
Common Mistakes:
Using normal folders which add to URL
Using square brackets which create dynamic routes
Placing all routes in one file
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.