forked from jmug/cactoide
feat: add an option to remove the landing page
This commit is contained in:
@@ -13,3 +13,5 @@ DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoide_data
|
|||||||
APP_VERSION=latest
|
APP_VERSION=latest
|
||||||
PORT=3000
|
PORT=3000
|
||||||
HOSTNAME=0.0.0.0
|
HOSTNAME=0.0.0.0
|
||||||
|
|
||||||
|
PUBLIC_LANDING_INFO=true
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -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.
|
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`.
|
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`.
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { t } from '$lib/i18n/i18n.js';
|
import { t } from '$lib/i18n/i18n.js';
|
||||||
|
import { PUBLIC_LANDING_INFO } from '$env/static/public';
|
||||||
|
|
||||||
// Check if current page is active
|
// Check if current page is active
|
||||||
const isActive = (path: string): boolean => {
|
const isActive = (path: string): boolean => {
|
||||||
@@ -24,12 +25,14 @@
|
|||||||
|
|
||||||
<!-- Navigation -->
|
<!-- Navigation -->
|
||||||
<div class="md:flex md:items-center md:space-x-8">
|
<div class="md:flex md:items-center md:space-x-8">
|
||||||
<button
|
{#if PUBLIC_LANDING_INFO !== 'false'}
|
||||||
on:click={() => goto('/')}
|
<button
|
||||||
class={isActive('/') ? 'text-violet-400' : 'cursor-pointer'}
|
on:click={() => goto('/')}
|
||||||
>
|
class={isActive('/') ? 'text-violet-400' : 'cursor-pointer'}
|
||||||
{t('navigation.home')}
|
>
|
||||||
</button>
|
{t('navigation.home')}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
on:click={() => goto('/discover')}
|
on:click={() => goto('/discover')}
|
||||||
|
|||||||
11
src/routes/+page.server.ts
Normal file
11
src/routes/+page.server.ts
Normal 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 {};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user