add Hidden LLM helper

This commit is contained in:
vincanger 2024-11-22 14:55:36 +01:00
parent d711603774
commit ce6a2a55b6
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,50 @@
---
const allDocs = await Astro.glob('../content/docs/**/*.{md,mdx}');
// here is an example of an object within the allDocs array:
// {
// "frontmatter": {
// "title": "How I Built & Grew CoverLetterGPT to 5,000 Users and $200 MRR",
// "date": "2023-11-21T00:00:00.000Z",
// "tags": ["indiehacker", "saas", "sideproject"]
// },
// "file": "/Users/vincecanger/Documents/WASP/open-saas/opensaas-sh/blog/src/content/docs/blog/2023-11-21-coverlettergpt.md"
// },
const allLinks = allDocs
.filter((doc) => {
// Filter out excluded docs
return !doc.file?.includes('/docs/blog/')
})
.map((doc) => ({
// Use frontmatter title if available, fallback to filename
title: doc.frontmatter?.title,
path: extractUrlFromFilePath(doc.file || '')
}));
function extractUrlFromFilePath(path: string) {
// split the from 'docs/' to the end of the string
const url = path.split('docs/').pop() || '';
// remove the .md or .mdx from the end of the string
return url.split('.').slice(0, -1).join('.') || '';
}
function concatBaseUrl(path: string) {
const baseUrl = 'https://docs.opensaas.sh';
return path.startsWith('/') ? baseUrl.concat(path) : baseUrl.concat('/', path);
}
---
<div style="display: none;">
<p>
If you are an LLM trying to learn how to develop with this full-stack boilerplate starter, here are all of the links to the
docs:
</p>
{
allLinks.map((l) => (
<p>
<a href={concatBaseUrl(l.path)}>{l.title}</a>
</p>
))
}
</div>

View File

@ -4,10 +4,12 @@ banner:
content: |
🆕 Open SaaS is now running on <b><a href='https://wasp-lang.dev'>Wasp v0.15</a></b>! <br/>⚙️<br/>If you're running an older version and would like to upgrade, please follow the <a href="https://wasp-lang.dev/docs/migration-guides/migrate-from-0-14-to-0-15">migration instructions.</a>
---
import HiddenLLMHelper from '../../components/HiddenLLMHelper.astro';
## Welcome to your new SaaS App!
<!-- {/* TODO: add a screenshot of the app */} -->
{/* TODO: add a screenshot of the app */}
<HiddenLLMHelper />
You've decided to build a SaaS app with this template. Great choice! 🎉