@@ -16,13 +16,17 @@ import { generateFeed, generateImages, generateMeta } from './hooks'
1616import { defs , emojiRender } from './markdown/emoji'
1717import { headersPlugin } from './markdown/headers'
1818import { toggleStarredPlugin } from './markdown/toggleStarred'
19- // import { transformsPlugin } from './transformer'
2019import { replaceNoteLink } from './utils/markdown'
2120
2221// @unocss -include
2322
24- // Sitio desplegado en https://interneto.github.io/
25- const baseUrl = '/' // for root GitHub Pages domain
23+ // Base del sitio (correcto para https://interneto.github.io/)
24+ const base = '/'
25+
26+ // Helper para evitar rutas absolutas rotas
27+ const withBase = ( p : string ) : string =>
28+ `${ base } ${ p . replace ( / ^ \/ + / , '' ) } `
29+
2630export default defineConfig ( {
2731 title : 'Interneto Links' ,
2832 description : meta . description ,
@@ -31,73 +35,50 @@ export default defineConfig({
3135 lastUpdated : false ,
3236 cleanUrls : true ,
3337 appearance : true ,
34- base : baseUrl ,
38+ base,
39+
3540 srcExclude : [ 'README.md' , 'single-page' , 'z/**' , 'apps-import/**' ] ,
3641 ignoreDeadLinks : true ,
42+
3743 sitemap : {
3844 hostname : meta . hostname
3945 } ,
46+
4047 head : [
4148 [ 'meta' , { name : 'theme-color' , content : '#7bc5e4' } ] ,
4249 [ 'meta' , { name : 'og:type' , content : 'website' } ] ,
4350 [ 'meta' , { name : 'og:locale' , content : 'en' } ] ,
44- [ 'link' , { rel : 'icon' , href : '/favicon.ico' } ] ,
45- [ 'link' , { rel : 'icon' , type : 'image/png' , sizes : '32x32' , href : '/favicon-32x32.png' } ] ,
46- [ 'link' , { rel : 'icon' , type : 'image/png' , sizes : '16x16' , href : '/favicon-16x16.png' } ] ,
47- // PWA
48- [ 'link' , { rel : 'manifest' , href : '/manifest.json' } ] ,
49- [ 'link' , { rel : 'alternate icon' , href : '/favicon.ico' } ] ,
50- [ 'link' , { rel : 'mask-icon' , href : '/note.svg' , color : '#000000ff' } ] ,
51- [ 'meta' , { name : 'keywords' , content : meta . keywords . join ( ' ' ) } ] ,
52- [ 'link' , { rel : 'apple-touch-icon' , href : '/apple-touch-icon.png' , sizes : '180x180' } ] ,
51+
52+ [ 'link' , { rel : 'icon' , href : withBase ( 'favicon.ico' ) } ] ,
53+ [ 'link' , { rel : 'icon' , type : 'image/png' , sizes : '32x32' , href : withBase ( 'favicon-32x32.png' ) } ] ,
54+ [ 'link' , { rel : 'icon' , type : 'image/png' , sizes : '16x16' , href : withBase ( 'favicon-16x16.png' ) } ] ,
55+
56+ [ 'link' , { rel : 'manifest' , href : withBase ( 'manifest.json' ) } ] ,
57+ [ 'link' , { rel : 'alternate icon' , href : withBase ( 'favicon.ico' ) } ] ,
58+ [ 'link' , { rel : 'mask-icon' , href : withBase ( 'note.svg' ) , color : '#000000ff' } ] ,
59+ [ 'link' , { rel : 'apple-touch-icon' , href : withBase ( 'apple-touch-icon.png' ) , sizes : '180x180' } ] ,
60+
5361 [ 'meta' , { name : 'apple-mobile-web-app-capable' , content : 'yes' } ] ,
5462 [ 'meta' , { name : 'apple-mobile-web-app-status-bar-style' , content : 'default' } ] ,
55- // Bing site verification
56- [
57- 'meta' ,
58- {
59- name : 'msvalidate.01' ,
60- content : 'F3028112EF6F929B562F4B18E58E3691'
61- }
62- ] ,
63- // Google site verification
64- [
65- 'meta' ,
66- {
67- name : 'google-site-verification' ,
68- content : 'XCq-ZTw6VJPQ7gVNEOl8u0JRqfadK7WcsJ0H598Wv9E'
69- }
70- ] ,
71- // Redirect to main site if embedded in iframe
72- [
73- 'script' ,
74- { } ,
75- `
76- (function() {
77- if (window.self !== window.top) {
78- window.top.location = window.location.href;
79- }
80- })();
81- `
82- ]
8363 ] ,
64+
8465 transformHead : async ( context ) => generateMeta ( context , meta . hostname ) ,
66+
8567 buildEnd : async ( context ) => {
8668 generateImages ( context )
8769 . then ( ( ) => generateFeed ( context ) )
8870 . finally ( ( ) => consola . success ( 'Success!' ) )
8971 } ,
72+
9073 vite : {
9174 css : {
9275 preprocessorOptions : {
9376 scss : {
94- api : 'modern-compiler'
77+ charset : false
9578 }
9679 }
9780 } ,
98- // ssr: {
99- // noExternal: ['@fmhy/components']
100- // },
81+
10182 resolve : {
10283 alias : [
10384 {
@@ -120,18 +101,23 @@ export default defineConfig({
120101 }
121102 ]
122103 } ,
104+
123105 optimizeDeps : { exclude : [ 'workbox-window' ] } ,
106+
124107 plugins : [
125108 OptimizeExclude ( ) ,
109+
126110 Terminal ( {
127111 console : 'terminal' ,
128112 output : [ 'console' , 'terminal' ]
129113 } ) ,
114+
130115 UnoCSS ( {
131116 configFile : fileURLToPath (
132117 new URL ( '../../unocss.config.ts' , import . meta. url )
133118 )
134119 } ) ,
120+
135121 AutoImport ( {
136122 dts : '../.cache/imports.d.ts' ,
137123 imports : [ 'vue' , 'vitepress' ] ,
@@ -141,87 +127,75 @@ export default defineConfig({
141127 filepath : './.cache/imports.json'
142128 }
143129 } ) ,
130+
144131 VitePWA ( {
145132 registerType : 'autoUpdate' ,
133+
146134 workbox : {
147135 globPatterns : [ '**/*.{js,css,html,ico,png,svg,woff2}' ] ,
148- runtimeCaching : [
149- {
150- urlPattern : / ^ h t t p s : \/ \/ f o n t s \. g o o g l e a p i s \. c o m \/ .* / i,
151- handler : 'CacheFirst' ,
152- options : {
153- cacheName : 'google-fonts-cache' ,
154- expiration : {
155- maxEntries : 10 ,
156- maxAgeSeconds : 60 * 60 * 24 * 365 // 365 days
157- } ,
158- cacheableResponse : {
159- statuses : [ 0 , 200 ]
160- }
161- }
162- }
163- ]
164136 } ,
137+
165138 manifest : {
166139 name : 'Interneto Links' ,
167140 short_name : 'Interneto' ,
168141 description : 'The largest collection of free stuff on the internet!' ,
169142 theme_color : '#000000ff' ,
170143 background_color : '#000000ff' ,
144+
171145 display : 'standalone' ,
172146 orientation : 'portrait' ,
173- scope : '/' ,
174- start_url : '/' ,
147+
148+ start_url : base ,
149+ scope : base ,
150+
175151 icons : [
176152 {
177- src : '/favicon.ico' ,
178- sizes : '16x16' ,
179- type : 'image/x-icon'
180- } ,
181- {
182- src : '/android-chrome-192x192.png' ,
153+ src : withBase ( 'android-chrome-192x192.png' ) ,
183154 sizes : '192x192' ,
184- type : 'image/png' ,
185- purpose : 'any maskable'
155+ type : 'image/png'
186156 } ,
187157 {
188- src : '/ android-chrome-512x512.png',
158+ src : withBase ( ' android-chrome-512x512.png') ,
189159 sizes : '512x512' ,
190- type : 'image/png' ,
191- purpose : 'any maskable'
160+ type : 'image/png'
192161 }
193162 ]
194163 }
195- } ) ,
164+ } )
196165 ] ,
166+
197167 build : {
198- // Shut the fuck up
199168 chunkSizeWarningLimit : Number . POSITIVE_INFINITY
200169 }
201170 } ,
171+
202172 markdown : {
203173 emoji : { defs } ,
204174 config ( md ) {
205175 md . use ( emojiRender )
206176 md . use ( toggleStarredPlugin )
207- meta . build . api && md . use ( headersPlugin )
177+ if ( meta . build . api ) md . use ( headersPlugin )
208178 replaceNoteLink ( md )
209179 }
210180 } ,
181+
211182 themeConfig : {
212183 search,
184+
213185 footer : {
214186 message :
215187 '<a href="https://github.com/interneto" target="_blank" rel="noopener noreferrer">GitHub</a> · <a href="https://interneto.raindrop.page/" target="_blank" rel="noopener noreferrer">raindrop.io</a> · <a href="https://twitter.com/internetoOK" target="_blank" rel="noopener noreferrer">X</a>' ,
216188 copyright : `© ${ new Date ( ) . getFullYear ( ) } Interneto. Curated link directory.`
217189 } ,
218190
219191 outline : 'deep' ,
192+
220193 logo : {
221- src : '/ icon.png',
194+ src : withBase ( ' icon.png') ,
222195 alt : 'Interneto Logo'
223196 } ,
197+
224198 nav,
225199 sidebar,
226200 }
227- } )
201+ } )
0 commit comments