2
0
forked from jmug/cactoide

feat: add an option to remove the landing page

This commit is contained in:
Levente Orban
2025-10-10 10:06:34 +02:00
parent a40b83c2b3
commit c98260efec
4 changed files with 34 additions and 7 deletions

View File

@@ -13,3 +13,5 @@ DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoide_data
APP_VERSION=latest
PORT=3000
HOSTNAME=0.0.0.0
PUBLIC_LANDING_INFO=true

View File

@@ -55,7 +55,18 @@ Your app will be available at `http://localhost:5173`. You can use the Makefile
Use the `database/seed.sql` if you want to populate your database with dummy data.
### i18n
### Options
#### 1. Landing page option
Supports a conditional landing page display based on the `PUBLIC_LANDING_INFO` environment variable. If you don't want to show your users the cactoide landing page, just use the `PUBLIC_LANDING_INFO=false` variable. This will automatically remove the landing home page and redirect users to the `/discover` page.
This is useful for:
- Creating a minimal discovery-focused experience
- Customizing the user journey based on deployment environment
#### 2. i18n
There is no proper i18n implemented, we have an `/i18n` folder with specific languages. To use an existing translation, just rename the language code JSON file to `messages.json` and you are ready to go. If you would like to add a new translation (which is really appreciated), just create a new `<language_code>.json` file and add the translations from the `messages.json`.

View File

@@ -2,6 +2,7 @@
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { t } from '$lib/i18n/i18n.js';
import { PUBLIC_LANDING_INFO } from '$env/static/public';
// Check if current page is active
const isActive = (path: string): boolean => {
@@ -24,12 +25,14 @@
<!-- Navigation -->
<div class="md:flex md:items-center md:space-x-8">
{#if PUBLIC_LANDING_INFO !== 'false'}
<button
on:click={() => goto('/')}
class={isActive('/') ? 'text-violet-400' : 'cursor-pointer'}
>
{t('navigation.home')}
</button>
{/if}
<button
on:click={() => goto('/discover')}

View File

@@ -0,0 +1,11 @@
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { PUBLIC_LANDING_INFO } from '$env/static/public';
export const load: PageServerLoad = async () => {
if (PUBLIC_LANDING_INFO === 'false') {
throw redirect(302, '/discover');
}
return {};
};