diff --git a/.spellcheckerrc.yml b/.spellcheckerrc.yml index 0ec37d44e..143b72f10 100644 --- a/.spellcheckerrc.yml +++ b/.spellcheckerrc.yml @@ -4,8 +4,12 @@ dictionaries: - dictionary.txt quiet: true language: en-US +frontmatter-keys: + - description + - title_seo plugins: - spell - syntax-urls - syntax-mentions - repeated-words + - frontmatter diff --git a/contentlayer.config.ts b/contentlayer.config.ts index 65a69907a..6f06de853 100644 --- a/contentlayer.config.ts +++ b/contentlayer.config.ts @@ -39,6 +39,13 @@ const Doc = defineDocumentType(() => ({ }, description: 'The tags of the post, used by guides', }, + languages: { + type: 'list', + of: { + type: 'string', + }, + description: 'The languages of the content, used by guides', + }, }, computedFields: { slug: { diff --git a/dictionary.txt b/dictionary.txt index 765163b14..ce41d70a1 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -217,10 +217,13 @@ misconfigurations DSL UI init +.env +.mkv +.jpg +.pdf ^.+[-:_]\w+$ [a-z]+([A-Z0-9]|[A-Z0-9]\w+) ([A-Z][a-z0-9]+)((\d)|([A-Z0-9][a-z0-9]+))*([A-Z])? ([a-zA-Z0-9]+\.[a-zA-Z0-9]+)+ -\..+ -️ +\..+️ diff --git a/docs/guides/dart/serverless-rest-api-example.mdx b/docs/guides/dart/serverless-rest-api-example.mdx index 8e71825fe..b4a8b33ba 100644 --- a/docs/guides/dart/serverless-rest-api-example.mdx +++ b/docs/guides/dart/serverless-rest-api-example.mdx @@ -4,6 +4,8 @@ title_seo: Building your first API with Dart and Nitric tags: - API - Key Value Store +languages: + - dart --- # Building a REST API with Nitric diff --git a/docs/guides/go/realtime-messaging.mdx b/docs/guides/go/realtime-messaging.mdx index 89f37aae9..bdf5cf9d9 100644 --- a/docs/guides/go/realtime-messaging.mdx +++ b/docs/guides/go/realtime-messaging.mdx @@ -3,6 +3,8 @@ description: Use the Nitric framework to easily build and deploy Go WebSocket ap tags: - Realtime & Websockets - Key Value Store +languages: + - go --- # Building a chat app in Go with WebSockets and Nitric diff --git a/docs/guides/go/serverless-rest-api-example.mdx b/docs/guides/go/serverless-rest-api-example.mdx index d0db7abd2..0c7ad7cf7 100644 --- a/docs/guides/go/serverless-rest-api-example.mdx +++ b/docs/guides/go/serverless-rest-api-example.mdx @@ -4,6 +4,8 @@ title_seo: Building your first API with Go and Nitric tags: - API - Key Value Store +languages: + - go --- # Building your first API with Nitric diff --git a/docs/guides/nodejs/amazon-cognito.mdx b/docs/guides/nodejs/amazon-cognito.mdx index 33fb78e9a..59e5d3122 100644 --- a/docs/guides/nodejs/amazon-cognito.mdx +++ b/docs/guides/nodejs/amazon-cognito.mdx @@ -4,6 +4,9 @@ tags: - Authentication - API - AWS +languages: + - typescript + - javascript --- # Securing APIs with Amazon Cognito diff --git a/docs/guides/nodejs/api-with-nextjs.mdx b/docs/guides/nodejs/api-with-nextjs.mdx index 139c89925..d975a538e 100644 --- a/docs/guides/nodejs/api-with-nextjs.mdx +++ b/docs/guides/nodejs/api-with-nextjs.mdx @@ -3,6 +3,9 @@ description: 'Build a serverless backend for your Next.js app using Nitric frame tags: - Frontend - API +languages: + - typescript + - javascript --- # Next.js and Nitric example application diff --git a/docs/guides/nodejs/byo-database.mdx b/docs/guides/nodejs/byo-database.mdx index 2a6fbefbb..cc012bac4 100644 --- a/docs/guides/nodejs/byo-database.mdx +++ b/docs/guides/nodejs/byo-database.mdx @@ -2,6 +2,9 @@ description: 'How to work with existing databases' tags: - Databases & CMS +languages: + - typescript + - javascript --- # BYO Database diff --git a/docs/guides/nodejs/debugging.mdx b/docs/guides/nodejs/debugging.mdx index d7e36c4ce..66727fb8f 100644 --- a/docs/guides/nodejs/debugging.mdx +++ b/docs/guides/nodejs/debugging.mdx @@ -2,6 +2,9 @@ description: Experience real-time updates, API exploration, and schedule debugging in Nitric's local development dashboard. tags: - Local Development +languages: + - typescript + - javascript --- # Debugging with Nitric diff --git a/docs/guides/nodejs/expressjs.mdx b/docs/guides/nodejs/expressjs.mdx index c42586aec..5914942ea 100644 --- a/docs/guides/nodejs/expressjs.mdx +++ b/docs/guides/nodejs/expressjs.mdx @@ -3,6 +3,9 @@ description: 'How to build an Express.js application with Nitric' tags: - API - HTTP Proxy +languages: + - typescript + - javascript --- # Enhance Express.js Apps with Cloud Resources diff --git a/docs/guides/nodejs/fastify.mdx b/docs/guides/nodejs/fastify.mdx index e81e32f66..0c5f04cc0 100644 --- a/docs/guides/nodejs/fastify.mdx +++ b/docs/guides/nodejs/fastify.mdx @@ -3,6 +3,9 @@ description: 'How to build a Fastify application with Nitric' tags: - API - HTTP Proxy +languages: + - typescript + - javascript --- # Add Cloud Resources to Fastify Apps diff --git a/docs/guides/nodejs/graphql.mdx b/docs/guides/nodejs/graphql.mdx index b48b970a2..9601515a0 100644 --- a/docs/guides/nodejs/graphql.mdx +++ b/docs/guides/nodejs/graphql.mdx @@ -3,6 +3,9 @@ description: Use the Nitric framework to easily build and deploy a serverless No title_seo: Building a GraphQL API with Node.js and Nitric tags: - API +languages: + - typescript + - javascript --- # Building a GraphQL API with Nitric diff --git a/docs/guides/nodejs/nestjs.mdx b/docs/guides/nodejs/nestjs.mdx index eece764b7..721db5542 100644 --- a/docs/guides/nodejs/nestjs.mdx +++ b/docs/guides/nodejs/nestjs.mdx @@ -4,6 +4,9 @@ tags: - API - HTTP Proxy - Key Value Store +languages: + - typescript + - javascript --- # Nest.js integration with Nitric diff --git a/docs/guides/nodejs/nitric-and-drizzle.mdx b/docs/guides/nodejs/nitric-and-drizzle.mdx index a33935799..7414e1012 100644 --- a/docs/guides/nodejs/nitric-and-drizzle.mdx +++ b/docs/guides/nodejs/nitric-and-drizzle.mdx @@ -3,6 +3,9 @@ description: 'How to work with Nitric SQL Databases and Drizzle' tags: - Databases & CMS - ORMs +languages: + - typescript + - javascript --- # Nitric SQL Databases with Drizzle diff --git a/docs/guides/nodejs/nitric-and-prisma.mdx b/docs/guides/nodejs/nitric-and-prisma.mdx index 5d2a80a91..0cff91732 100644 --- a/docs/guides/nodejs/nitric-and-prisma.mdx +++ b/docs/guides/nodejs/nitric-and-prisma.mdx @@ -3,6 +3,9 @@ description: 'How to work with Nitric SQL Databases and Prisma' tags: - Databases & CMS - ORMs +languages: + - typescript + - javascript --- # Nitric SQL Databases with Prisma diff --git a/docs/guides/nodejs/nitric-and-supabase.mdx b/docs/guides/nodejs/nitric-and-supabase.mdx index cba066828..11abdeda0 100644 --- a/docs/guides/nodejs/nitric-and-supabase.mdx +++ b/docs/guides/nodejs/nitric-and-supabase.mdx @@ -2,6 +2,9 @@ description: 'Add services, queues, events or secrets to Supabase apps using the Nitric framework' tags: - Databases & CMS +languages: + - typescript + - javascript --- # Extend Supabase Apps with Nitric diff --git a/docs/guides/nodejs/secure-api-auth0.mdx b/docs/guides/nodejs/secure-api-auth0.mdx index 27188a3d6..3a8c83503 100644 --- a/docs/guides/nodejs/secure-api-auth0.mdx +++ b/docs/guides/nodejs/secure-api-auth0.mdx @@ -2,6 +2,9 @@ description: 'Configure an Auth0 application and secure your API with it' tags: - Authentication +languages: + - typescript + - javascript --- # Securing your API with Auth0 diff --git a/docs/guides/nodejs/serverless-api-with-planetscale-and-prisma.mdx b/docs/guides/nodejs/serverless-api-with-planetscale-and-prisma.mdx index c831ab87f..edbc5453b 100644 --- a/docs/guides/nodejs/serverless-api-with-planetscale-and-prisma.mdx +++ b/docs/guides/nodejs/serverless-api-with-planetscale-and-prisma.mdx @@ -3,6 +3,9 @@ description: 'Use PlanetScale serverless database, Prisma ORM and Nitric framewo tags: - Databases & CMS - ORMs +languages: + - typescript + - javascript --- # APIs with PlanetScale, Prisma and Nitric diff --git a/docs/guides/nodejs/serverless-rest-api-example.mdx b/docs/guides/nodejs/serverless-rest-api-example.mdx index 792a6c718..d92833028 100644 --- a/docs/guides/nodejs/serverless-rest-api-example.mdx +++ b/docs/guides/nodejs/serverless-rest-api-example.mdx @@ -4,6 +4,9 @@ title_seo: Building your first API with Node.js and Nitric tags: - API - Key Value Store +languages: + - typescript + - javascript --- # Building a REST API with Nitric diff --git a/docs/guides/nodejs/stripe.mdx b/docs/guides/nodejs/stripe.mdx index 252f645d7..d64cf0a2f 100644 --- a/docs/guides/nodejs/stripe.mdx +++ b/docs/guides/nodejs/stripe.mdx @@ -3,6 +3,9 @@ description: 'Build a serverless application with Stripe and Nitric for AWS, Goo tags: - API - Payments +languages: + - typescript + - javascript --- # Integrating Stripe with Nitric diff --git a/docs/guides/nodejs/testing.mdx b/docs/guides/nodejs/testing.mdx index eb9581941..7addfeb87 100644 --- a/docs/guides/nodejs/testing.mdx +++ b/docs/guides/nodejs/testing.mdx @@ -2,6 +2,9 @@ description: 'How to test Nitric applications' tags: - Testing +languages: + - typescript + - javascript --- # Testing diff --git a/docs/guides/nodejs/twilio.mdx b/docs/guides/nodejs/twilio.mdx index 9f2336ebc..3e1d57c0d 100644 --- a/docs/guides/nodejs/twilio.mdx +++ b/docs/guides/nodejs/twilio.mdx @@ -3,6 +3,9 @@ description: 'Build a serverless application with Twilio and Nitric for AWS, Goo tags: - API - Messaging +languages: + - typescript + - javascript --- # Integrating Twilio with Nitric diff --git a/docs/guides/nodejs/uptime.mdx b/docs/guides/nodejs/uptime.mdx index 86f0c02db..aa49a6035 100644 --- a/docs/guides/nodejs/uptime.mdx +++ b/docs/guides/nodejs/uptime.mdx @@ -2,6 +2,9 @@ description: Learn how to develop an event-driven uptime monitoring tool using Node.js and Nitric. tags: - API +languages: + - typescript + - javascript --- # Build an Uptime Monitoring Tool with Nitric diff --git a/docs/guides/nodejs/websockets.mdx b/docs/guides/nodejs/websockets.mdx index b2ffdc85a..27a81a7a4 100644 --- a/docs/guides/nodejs/websockets.mdx +++ b/docs/guides/nodejs/websockets.mdx @@ -2,6 +2,9 @@ description: 'Getting started building realtime applications on Nitric' tags: - Realtime & Websockets +languages: + - typescript + - javascript --- # Websockets guide diff --git a/docs/guides/python/create-histogram.mdx b/docs/guides/python/create-histogram.mdx index d7c7431e3..1485ee479 100644 --- a/docs/guides/python/create-histogram.mdx +++ b/docs/guides/python/create-histogram.mdx @@ -3,6 +3,8 @@ description: 'Use the Nitric framework to easily build and deploy a serverless d tags: - API - Data Visualization +languages: + - python --- # Building a data visualization API with Nitric diff --git a/docs/guides/python/graphql.mdx b/docs/guides/python/graphql.mdx index 09d100489..dfcec238c 100644 --- a/docs/guides/python/graphql.mdx +++ b/docs/guides/python/graphql.mdx @@ -3,6 +3,8 @@ description: 'Use the Nitric framework to easily build and deploy a serverless P title_seo: Building a GraphQL API with Python and Nitric tags: - API +languages: + - python --- # Building a GraphQL API with Nitric diff --git a/docs/guides/python/scheduled-report.mdx b/docs/guides/python/scheduled-report.mdx index 947f18093..b7792750a 100644 --- a/docs/guides/python/scheduled-report.mdx +++ b/docs/guides/python/scheduled-report.mdx @@ -5,6 +5,8 @@ tags: - API - Google - Schedules +languages: + - python --- # Generate a report with Google Sheets and share it with Google Drive diff --git a/docs/guides/python/serverless-rest-api-example.mdx b/docs/guides/python/serverless-rest-api-example.mdx index 68e61aad9..d5d812c55 100644 --- a/docs/guides/python/serverless-rest-api-example.mdx +++ b/docs/guides/python/serverless-rest-api-example.mdx @@ -4,6 +4,8 @@ description: Use the Nitric framework to easily build and deploy Python REST API tags: - API - Key Value Store +languages: + - python --- # Building your first API with Nitric diff --git a/docs/guides/python/text-prediction.mdx b/docs/guides/python/text-prediction.mdx index 3fc3fad66..f14184dc9 100644 --- a/docs/guides/python/text-prediction.mdx +++ b/docs/guides/python/text-prediction.mdx @@ -2,6 +2,8 @@ description: Use the Nitric framework and Tensorflow to easily train a prediction model and deploy to AWS, Google Cloud, or Azure tags: - AI & Machine Learning +languages: + - python --- # Building serverless text prediction from training to deployment diff --git a/docs/guides/terraform/terratest.mdx b/docs/guides/terraform/terratest.mdx index f92c0c1d0..97a8674eb 100644 --- a/docs/guides/terraform/terratest.mdx +++ b/docs/guides/terraform/terratest.mdx @@ -3,6 +3,8 @@ description: Use Terratest to validate the infrastructure of a Nitric Go project tags: - Terraform - Testing +languages: + - go --- # Testing AWS resources with Terratest diff --git a/package.json b/package.json index 1e049124a..ddd15cca9 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "prettier": "^3.3.2", "prettier-plugin-tailwindcss": "^0.6.5", "prisma": "^5.20.0", + "remark-frontmatter": "^5.0.0", "sharp": "0.33.1", "spellchecker-cli": "^6.2.0" } diff --git a/src/components/FeedbackForm.tsx b/src/components/FeedbackForm.tsx index 35a8dd58d..02835f374 100644 --- a/src/components/FeedbackForm.tsx +++ b/src/components/FeedbackForm.tsx @@ -72,14 +72,17 @@ const FeedbackForm = () => { > {choices.map(({ label, value, emoji }) => (
- - + + {emoji} + -
))} diff --git a/src/components/LanguageSwitch/LanguageSwitch.client.tsx b/src/components/LanguageSwitch/LanguageSwitch.client.tsx index f3677a90c..4892ae7d2 100644 --- a/src/components/LanguageSwitch/LanguageSwitch.client.tsx +++ b/src/components/LanguageSwitch/LanguageSwitch.client.tsx @@ -1,32 +1,39 @@ 'use client' -import useLang, { LanguageId } from '@/hooks/useLang' import { cn } from '@/lib/utils' import React from 'react' import { Button } from '../ui/button' +import { languages } from '@/lib/constants' +import { LanguageIcon } from '../icons/LanguageIcon' +import useParams from '@/hooks/useParams' -export const LanguageSwitchClient = ({ - languages, -}: { - languages: { name: string; icon: React.ReactNode }[] -}) => { - const { currentLanguage, setCurrentLanguage } = useLang() +export const LanguageSwitchClient = () => { + const { setParams, searchParams } = useParams() + const selectedLangs = searchParams?.get('langs')?.split(',') || [] + + const handleLanguageChange = (lang: string) => { + if (!selectedLangs.includes(lang)) { + setParams('langs', [...selectedLangs, lang].join(',')) + } else { + setParams( + 'langs', + selectedLangs.filter((selected) => selected !== lang).join(','), + ) + } + } return ( } > - + ) } diff --git a/src/components/code/CodeSwitcherSelect.tsx b/src/components/code/CodeSwitcherSelect.tsx index 2251aae65..d3527c698 100644 --- a/src/components/code/CodeSwitcherSelect.tsx +++ b/src/components/code/CodeSwitcherSelect.tsx @@ -10,8 +10,9 @@ import { SelectTrigger, SelectValue, } from '../ui/select' -import useLang, { LanguageId } from '@/hooks/useLang' +import useLang from '@/hooks/useLang' import { cn } from '@/lib/utils' +import { Language } from '@/lib/constants' const languageMap: Record = { javascript: 'JavaScript', @@ -47,7 +48,7 @@ export function CodeSwitcherSelect({ value={currentLanguage} onValueChange={(lang) => { // This is necessary to fix a ui update delay causing 200ms lag - setTimeout(() => setCurrentLanguage(lang as LanguageId), 0) + setTimeout(() => setCurrentLanguage(lang as Language), 0) }} >