Challenge - 5 Problems
Astro Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
š§ Conceptual
intermediateIdentify the main folder for page components in Astro
In an Astro project, which folder typically contains the page components that define the routes of the website?
Attempts:
2 left
š” Hint
Think about where you place files that correspond to website pages.
ā Incorrect
The src/pages folder holds page components that map to routes in Astro. Files here become pages automatically.
ā component_behavior
intermediateWhere to place reusable UI parts in Astro?
You want to create a button component to reuse across many pages in your Astro project. Which folder is the best place to put this component?
Attempts:
2 left
š” Hint
Reusable UI parts usually go in a dedicated folder separate from pages.
ā Incorrect
The src/components folder is for reusable UI components like buttons, headers, or cards.
š Syntax
advancedWhat is the correct file extension for Astro components?
Which file extension should you use for Astro component files to ensure they are recognized and processed correctly?
Attempts:
2 left
š” Hint
Astro components have their own special file extension.
ā Incorrect
Astro components use the .astro extension to enable Astro's templating and features.
š§ Debug
advancedWhy is a static asset not loading from the public folder?
You placed an image file in the
public/images folder but it does not show up on your site. What is a common mistake that causes this?Attempts:
2 left
š” Hint
Static assets in public are served from the root URL, so paths must start with a slash.
ā Incorrect
Assets in public are served from the root. Using a relative path like ./images/pic.png will not find the file. Use /images/pic.png instead.
ā lifecycle
expertHow does Astro handle server-side rendering and static generation in project structure?
In Astro, where do you configure whether a page is statically generated or server-side rendered, and how does this relate to the project structure?
Attempts:
2 left
š” Hint
Astro uses frontmatter flags inside page files to control rendering mode.
ā Incorrect
Astro lets you control rendering per page by exporting the prerender flag in the frontmatter of files in src/pages. This is part of the project structure and file content.
