(absPath: string)
| 234 | } |
| 235 | |
| 236 | function readMetaFromFile(absPath: string): { |
| 237 | title?: string; |
| 238 | description?: string; |
| 239 | } { |
| 240 | try { |
| 241 | const raw = fs.readFileSync(absPath, "utf-8"); |
| 242 | const { data } = matter(raw); |
| 243 | return { |
| 244 | title: typeof data.title === "string" ? data.title : undefined, |
| 245 | description: |
| 246 | typeof data.description === "string" ? data.description : undefined, |
| 247 | }; |
| 248 | } catch (err) { |
| 249 | // Log so an author whose page has malformed YAML / unreadable file |
| 250 | // can correlate "my page appears bare in /llms.txt" with the |
| 251 | // underlying cause. Empty meta is still returned so the rest of the |
| 252 | // index render keeps going. |
| 253 | console.error("[llm-text] failed to read meta", absPath, err); |
| 254 | return {}; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | // ----------------------------------------------------------------------- |
| 259 | // Snippet resolution |
no test coverage detected
searching dependent graphs…