@@ -8,21 +8,26 @@ import { generateNav } from '@binarynoir/vitepress-auto-navbar';
88import { generateSidebar } from '@binarynoir/vitepress-auto-sidebar' ;
99import { imageFallbackPlugin } from '@binarynoir/vite-plugin-image-fallback' ;
1010import { optimizeImagesPlugin } from '@binarynoir/vite-plugin-optimize-images' ;
11+ import { downloadsMarkdown , downloadsVitePlugin } from '@binarynoir/vitepress-downloads' ;
12+ import { downloadsSrcExclude } from '@binarynoir/vitepress-downloads/vitepress' ;
1113
1214// import.meta.dirname, not __dirname: VitePress configs are ESM.
1315const docsRoot = path . resolve ( import . meta. dirname , '..' ) ;
1416
1517const SITE_URL = 'https://binarynoir.github.io' ;
1618
19+ // @binarynoir /vitepress-downloads: the same options go to all three pieces below.
20+ const downloadsOptions = { folders : [ 'downloads' , 'files' ] } ;
21+
1722export default defineConfig ( {
1823 title : 'BinaryNoir' ,
1924 description : 'Open-source tools and VitePress plugins by BinaryNoir, with live demos.' ,
2025 lang : 'en-US' ,
2126 cleanUrls : true ,
2227 lastUpdated : true ,
2328
24- // Downloadable files are published as-is, never built as pages.
25- srcExclude : [ '**/downloads/**' ] ,
29+ // Files in a `downloads` or ` files` folder are published as-is, never built as pages.
30+ srcExclude : downloadsSrcExclude ( downloadsOptions ) ,
2631
2732 sitemap : { hostname : SITE_URL } ,
2833
@@ -93,6 +98,8 @@ export default defineConfig({
9398 md . use ( readingTimeTag ) ;
9499 // @binarynoir /vitepress-markdown-tags: ((tag|Done|green)) becomes a badge.
95100 md . use ( markdownTags ) ;
101+ // @binarynoir /vitepress-downloads: links into a `downloads` or `files` folder become file downloads.
102+ md . use ( downloadsMarkdown , downloadsOptions ) ;
96103 } ,
97104 } ,
98105
@@ -115,6 +122,8 @@ export default defineConfig({
115122 optimizeImagesPlugin ( { verbose : true } ) ,
116123 // Keeps `tagged: true` pages current while running `vitepress dev`.
117124 taggedPagesVitePlugin ( ) ,
125+ // Publishes the files in each `downloads` or `files` folder at their page-relative URL.
126+ downloadsVitePlugin ( downloadsOptions ) ,
118127 ] ,
119128 } ,
120129} ) ;
0 commit comments