mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-09 12:57:48 +00:00
Merge branch 'fix-ssr-svelte' of https://github.com/appwrite/website into fix-ssr-svelte
This commit is contained in:
@@ -2,8 +2,15 @@ import { base } from '$app/paths';
|
||||
import type { Tutorial } from '$markdoc/layouts/Tutorial.svelte';
|
||||
|
||||
const framework_order = ['React', 'Vue', 'SvelteKit', 'Stripe', 'Refine'];
|
||||
const category_order = ['Web', 'Mobile and native', 'Server', 'Auth', 'Databases', 'Storage', 'Functions'];
|
||||
|
||||
const category_order = [
|
||||
'Web',
|
||||
'Mobile and native',
|
||||
'Server',
|
||||
'Auth',
|
||||
'Databases',
|
||||
'Storage',
|
||||
'Functions'
|
||||
];
|
||||
|
||||
export async function load() {
|
||||
const tutorialsGlob = import.meta.glob('./**/step-1/+page.markdoc', {
|
||||
@@ -20,7 +27,7 @@ export async function load() {
|
||||
.replace('/+page.markdoc', '')
|
||||
.replace('/step-1', '');
|
||||
const tutorialName = slug.slice(slug.lastIndexOf('/') + 1);
|
||||
|
||||
|
||||
return {
|
||||
title: frontmatter.title,
|
||||
framework: frontmatter.framework,
|
||||
@@ -29,6 +36,7 @@ export async function load() {
|
||||
href: `${base}/docs/tutorials/${tutorialName}`
|
||||
};
|
||||
})
|
||||
.filter((tutorial) => !tutorial.draft)
|
||||
.sort((a, b) => {
|
||||
// Sort by framework order
|
||||
const frameworkIndexA = framework_order.indexOf(a.framework as string);
|
||||
@@ -44,23 +52,23 @@ export async function load() {
|
||||
// Else, sort by title
|
||||
return a.title.toLowerCase().localeCompare(b.title.toLowerCase());
|
||||
});
|
||||
|
||||
const tutorials = Object.entries(
|
||||
allTutorials.reduce((acc: { [key: string]: any[] }, item) => {
|
||||
// If the category does not exist in the accumulator, initialize it
|
||||
if (!acc[item.category]) {
|
||||
acc[item.category] = [];
|
||||
}
|
||||
|
||||
// Push the current item into the appropriate category
|
||||
acc[item.category].push(item);
|
||||
const tutorials = Object.entries(
|
||||
allTutorials.reduce((acc: { [key: string]: any[] }, item) => {
|
||||
// If the category does not exist in the accumulator, initialize it
|
||||
if (!acc[item.category]) {
|
||||
acc[item.category] = [];
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
).map(([title, tutorials]) => ({ title, tutorials }));
|
||||
|
||||
tutorials.sort((a, b) => category_order.indexOf(a.title) - category_order.indexOf(b.title));
|
||||
// Push the current item into the appropriate category
|
||||
acc[item.category].push(item);
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
).map(([title, tutorials]) => ({ title, tutorials }));
|
||||
|
||||
tutorials.sort((a, b) => category_order.indexOf(a.title) - category_order.indexOf(b.title));
|
||||
return {
|
||||
tutorials,
|
||||
tutorials
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ title: Server-side authentication with Nuxt
|
||||
description: Add SSR authentication to your Nuxt app with Appwrite
|
||||
step: 1
|
||||
difficulty: beginner
|
||||
draft: true
|
||||
readtime: 20
|
||||
framework: Nuxt SSR
|
||||
category: Auth
|
||||
|
||||
Reference in New Issue
Block a user