#Discord dashboard development

4 messages · Page 1 of 1 (latest)

trim zenith
#

I'm looking to use subdomain redirects with this project. Is astro a good option to use for creating a multibot dashboard with subdomain redirects to switch between different bot management?

wheat scarabBOT
#

Hi @trim zenith. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, Astro does support redirects, including the ability to configure custom domains and subdomains, which could be useful for your multibot dashboard project.

Astro offers several ways to implement redirects:

  1. Configured Redirects: You can specify permanent redirects in your Astro config file. As of Astro v2.9.0, you can map old routes to new routes, including external URLs:
import { defineConfig } from "astro/config";

export default defineConfig({
  redirects: {
    "/old-page": "/new-page",
    "/blog": "<https://example.com/blog">
  }
});

You can also customize the redirection status code:

export default defineConfig({
  redirects: {
    '/other': {
      status: 302,
      destination: '/place',
    },
  }
})

Configuration Reference

  1. Dynamic Redirects: You can use the Astro.redirect() method to redirect users dynamically based on certain conditions:
---
import { isLoggedIn } from "../utils";

const cookie = Astro.request.headers.get("cookie");
// If the user is not logged in, redirect them to the login page
if (!isLoggedIn(cookie)) {
  return Astro.redirect("/login");
}
---

Routing Guide

  1. Domain Configuration: For subdomain handling specifically, Astro v4.9.0 introduced the domains option for internationalization, which allows you to customize domains on a per-language basis for server-rendered projects:
#
export default defineConfig({
  site: "<https://example.com",>
  output: "server", // required, with no prerendered pages
  adapter: node({
    mode: 'standalone',
  }),
  i18n: {
    defaultLocale: "en",
    locales: ["en", "fr", "pt-br", "es"],
    prefixDefaultLocale: false,
    domains: {
      fr: "<https://fr.example.com",>
      es: "<https://example.es">
    }
  },
})

Internationalization Guide

While this feature is primarily designed for internationalization, the underlying mechanism for handling different subdomains could potentially be adapted for your multibot dashboard use case.

For your specific use case of a multibot dashboard with subdomain redirects, Astro would be a viable option, especially if you're using server-side rendering (SSR) with an adapter like @astrojs/node or @astrojs/vercel. The domain configuration feature, combined with dynamic redirects, could provide the functionality you need to switch between different bot management interfaces.

However, the knowledge sources don't specifically address multibot dashboards or Discord integration, so you might need to explore additional resources or examples for that specific implementation.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: