Test MDX File
6 minutes de lecture
By Test Author December 19, 2024This is a test MDX file to verify the resources collection is working properly.
Test MDX Content
This is a test MDX file with proper frontmatter. It should now appear in your resources collection.
π― Relative Path Solution for Imagetools
β NEW: Relative Paths with Custom Wrappers
π Two Images Side by Side (50% each)
π Original: Public Paths (Still Work)
Different Format Generation
Quality Optimization
Interactive Image Gallery
π Glob Pattern Gallery - Auto-load from Directory!
IMG 20210731 003002 242
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210711 210122 387
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210711 210122 345
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210611 185222 078
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210611 185222 023
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210224 110541 725
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210224 110541 721
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20201219 172830 671
boops md
Edc 450 Mould 45
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05815
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05198
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05173
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04881
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04700
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04648
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04389
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03876
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03770
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03481
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03470
boops
IMG 20210731 003002 242
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210711 210122 387
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210711 210122 345
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210611 185222 078
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210611 185222 023
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210224 110541 725
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210224 110541 721
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20201219 172830 671
boops md
Edc 450 Moule 45
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05815
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05198
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05173
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04881
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04700
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04648
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04389
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03876
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03770
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03481
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03470
boops
Manual Images (Original Method)
Test Image 1 (Relative)
Cette image utilise le chemin relatif ./test.jpg
Test Image 2 (Relative)
Cette image utilise le chemin relatif ./test.jpg
Image test 1 (relative)
Cette image utilise le chemin relatif ./test.jpg
Image test 2 (relative)
Cette image utilise le chemin relatif ./test.jpg
π Glob Pattern Support:
IMG 20210731 003002 242
IMG 20210711 210122 387
IMG 20210711 210122 345
IMG 20210611 185222 078
IMG 20210611 185222 023
IMG 20210224 110541 725
IMG 20210224 110541 721
IMG 20201219 172830 671
Edc 450 Mould 45
DSC05815
DSC05198
DSC05173
DSC04881
DSC04700
DSC04648
DSC04389
DSC03876
DSC03770
DSC03481
DSC03470
IMG 20210731 003002 242
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210711 210122 387
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210711 210122 345
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210611 185222 078
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210611 185222 023
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210224 110541 725
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20210224 110541 721
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
IMG 20201219 172830 671
boops md
Edc 450 Moule 45
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05815
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05198
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC05173
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04881
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04700
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04648
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC04389
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03876
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03770
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03481
ChargΓ© automatiquement Γ partir de ./gallery/*.jpg
DSC03470
boops
Manual Usage:
import RelativeImage from "@polymech/astro-base/components/RelativeImage.astro";
<RelativeImage src="./my-image.jpg" alt="My image" width={400} />
FileTree Component Example
π Auto-Generated FileTree with Glob Patterns!
No more manually typing out file structures! Just like RelativeGallery, FileTree now supports glob patterns with clickable file links:
Directoryresources/
Directoryinfo/
- config.ts
Specific Directory Structure (with custom URL prefix)
- No files found matching pattern:
../components/**/*
Searched in:C:/Users/zx/Desktop/polymech/site2/src/content/components
VS Code Integration Example
- No files found matching pattern:
../src/components/polymech/**/*.{ts,astro}
Searched in:C:/Users/zx/Desktop/polymech/site2/src/content/src/components/polymech
π Thumbnail View (Windows Explorer Style)
Perfect for browsing images and visual files with modern, subtle link styling (no more aggressive blue!):
../public/images/**/*.{jpg,jpeg,png,gif,webp,svg}
Searched in:
C:/Users/zx/Desktop/polymech/site2/src/content/public/images
Large Thumbnails for Detailed Preview
../public/products/**/*.{jpg,jpeg,png}
Searched in:
C:/Users/zx/Desktop/polymech/site2/src/content/public/products
Small Thumbnails for Compact View
Debug example with current directory images and proper icons:
./gallery/*
Searched in:
C:/Users/zx/Desktop/polymech/site2/src/content/fr/gallery
Mixed content with folders and files:
For comparison, hereβs a tree view of the same files:
- No files found matching pattern:
./*.jpg
Searched in:C:/Users/zx/Desktop/polymech/site2/src/content/fr
Debug Example - Non-existent Path
This will show the βNo files foundβ message with absolute path:
./non-existent/*.jpg
Searched in:
C:/Users/zx/Desktop/polymech/site2/src/content/fr/non-existent
- No files found matching pattern:
./another-missing-dir/**/*.png
Searched in:C:/Users/zx/Desktop/polymech/site2/src/content/fr/another-missing-dir
Manual FileTree (Original Method)
Hereβs an example of the FileTree component with manual structure:
Directorypublic/
Directoryimages/
- logo.svg
- hero.jpg
- favicon.ico
Directorysrc/
Directorycomponents/
- Header.astro Important component
- Footer.astro
- Navigation.astro
Directorylayouts/
- Layout.astro
Directorypages/
- index.astro
- about.astro
Directoryblog/
- [β¦slug].astro
Directorystyles/
- global.css
- astro.config.mjs
- package.json
- README.md
Advanced FileTree Features
Directorysrc/
Directorycomponents/
Directoryui/
- Button.tsx React component
- Input.vue Vue component
- Modal.svelte Svelte component
Directorylayouts/
- BaseLayout.astro
- BlogLayout.astro
Directoryutils/
- helpers.ts
- constants.js
Directorytypes/
- index.d.ts TypeScript definitions
- β¦
Directorytests/
Directoryunit/
- components.test.ts
Directorye2e/
- homepage.spec.ts
Directorydocs/
- getting-started.md Start here!
- api-reference.md
Directory.github/
Directoryworkflows/
- ci.yml
- package.json
- tsconfig.json
More Glob Examples
Show just the current directory:
- No files found matching pattern:
./*
Searched in:C:/Users/zx/Desktop/polymech/site2/src/content/fr
Show all TypeScript files in the project:
Directoryresources/
Directorycassandra/
- config.ts
Show configuration files only:
FileTree Usage Examples
// Tree view (default) - hierarchical structure
<FileTree glob="../src/**/*.astro" maxDepth={3} />
// Thumbnail view - Windows Explorer style grid
<FileTree
glob="../public/images/**/*.{jpg,png,gif}"
view="thumbs"
thumbSize="medium"
/>
// Large thumbnails for detailed preview
<FileTree
glob="../assets/**/*.{jpg,png}"
view="thumbs"
thumbSize="large"
maxDepth={2}
/>
// Small thumbnails for compact display
<FileTree
glob="../gallery/**/*"
view="thumbs"
thumbSize="small"
linkFiles={false}
/>
// Custom URL prefix for GitHub integration
<FileTree
glob="../**/*.ts"
urlPrefix="https://github.com/username/repo/blob/main"
maxDepth={3}
/>
// VS Code integration - files open in editor
<FileTree
glob="../**/*.astro"
urlPrefix="vscode://file"
maxDepth={2}
/>
// Disable links if you just want display
<FileTree
glob="../**/*"
linkFiles={false}
maxDepth={2}
/>
// Show hidden files with custom dev server URL
<FileTree
glob="../**/*"
showHidden={true}
urlPrefix="http://localhost:3000"
maxDepth={2}
/>
// Manual structure (original way - no links)
<FileTree>
- src/
- components/
- Header.astro
</FileTree>
View Modes:
- Tree View (
view="tree"
): Traditional hierarchical file tree with folders and files - Thumbnail View (
view="thumbs"
): Grid layout like Windows Explorer with image previews
Thumbnail Sizes:
- Small (
thumbSize="small"
): 80px thumbnails for compact display - Medium (
thumbSize="medium"
): 120px thumbnails (default) - Large (
thumbSize="large"
): 160px thumbnails for detailed preview
Link Types Supported:
- Default:
file://
protocol for local file system - VS Code:
vscode://file/
for opening in VS Code - GitHub:
https://github.com/user/repo/blob/main/
for web viewing - Custom: Any URL prefix you provide
- Disabled: Set
linkFiles={false}
for display only
Breadcrumb Navigation
The Resources collection now includes automatic breadcrumb navigation!
Features:
- Auto-generated: Breadcrumbs are automatically created based on your URL path
- Smart labeling: Uses your page title for the current page, formatted directory names for paths
- Accessible: Full ARIA support with proper labels and navigation structure
- Responsive: Mobile-friendly design that adapts to smaller screens
- Customizable: Easy to disable per page or customize styling
Usage:
Enable breadcrumbs (default behavior):
---
title: "My Page Title"
# Breadcrumbs will show automatically
---
Disable breadcrumbs for a specific page:
---
title: "My Page Title"
breadcrumb: false
---
Example Breadcrumb Path:
For a page at /resources/guides/getting-started/
, the breadcrumb would show:
Home / Resources / Guides / Getting Started
The breadcrumb component is reusable and can be easily integrated into other collection layouts as needed.
π Sidebar Autogenerated Nodes with Sorting
The sidebar now supports configurable sorting for autogenerated nodes! By default, all autogenerated sidebar sections use alphabetical sorting.
Available Sort Functions:
'alphabetical'
(Default): Sorts items alphabetically by label, with files before groups'date'
: Sorts bypubDate
frontmatter field (newest first), fallback to alphabetical'custom'
: Use your own custom sorting function
Configuration Examples:
Basic Alphabetical Sorting (Default)
// src/config/sidebar.ts
export const sidebarConfig: SidebarGroup[] = [
{
label: 'Resources',
autogenerate: {
directory: 'resources',
collapsed: false,
sortBy: 'alphabetical' // This is the default
},
},
];
Date-based Sorting (Newest First)
{
label: 'Blog Posts',
autogenerate: {
directory: 'blog',
collapsed: false,
sortBy: 'date' // Requires pubDate in frontmatter
},
}
Custom Sorting Function
{
label: 'Custom Sorted',
autogenerate: {
directory: 'docs',
collapsed: false,
sortBy: 'custom',
customSort: (a, b) => {
// Custom logic here - example: prioritize certain files
if (a.label.startsWith('Getting Started')) return -1;
if (b.label.startsWith('Getting Started')) return 1;
return a.label.localeCompare(b.label);
}
},
}
Features:
- Hierarchical sorting: Applies to both files and subdirectories
- Files before groups: Files always appear before subdirectory groups in alphabetical mode
- Fallback support: Date sorting falls back to alphabetical when no dates are available
- Deep nesting: Sorting applies recursively to all nested levels
- Type safety: Full TypeScript support with proper type definitions
Migration:
Existing configurations will continue to work unchanged - alphabetical sorting is now the explicit default instead of being hardcoded.
Mermaid Diagrams
Now we have full support for Mermaid diagrams in MDX! Here are some examples: