Skip to content

Commit

Permalink
add Hidden LLM helper
Browse files Browse the repository at this point in the history
  • Loading branch information
vincanger committed Nov 22, 2024
1 parent d711603 commit ce6a2a5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
50 changes: 50 additions & 0 deletions opensaas-sh/blog/src/components/HiddenLLMHelper.astro
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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! 🎉

Expand Down

0 comments on commit ce6a2a5

Please sign in to comment.