mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 15:08:51 +00:00
docs: searchable documentation & seo (#911)
* create search field * search trigger, show field on interaction * update deps, fix emitter * crop out html, filtered search, i18h, layout * i18n * catch crtl f * create combindes result store * fix search query, remove store * fixed search on side * fix preload * improve mobile layout, assets * layout optimisations * header * doc nav bar, mobile, new dashboard * toolbar * fix modal * z-index issue, header * hl param * fix lang switch, nav * home, sub section, 18n, layout, assets * develope, docs sublinks * update home, mobile first * fix language switcher * add home seo * fix flex search, dashboard * seo embed, fix docs dropdown * mouse navigation in search * jsonld * seo * fix link * rm section if none * rm unused segment * update lock * remove combined slug * Apply suggestions from code review Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
co-authored by
Florian Forster
parent
202aae4954
commit
1fc4034373
@@ -4,19 +4,33 @@ import { locale } from 'svelte-i18n';
|
||||
import { LANGUAGES } from '../../config.js';
|
||||
import { INIT_OPTIONS } from '../i18n.js';
|
||||
import generate_docs from '../utils/generate_docs.js';
|
||||
import generate_seo from '../utils/generate_seo.js';
|
||||
|
||||
let json;
|
||||
|
||||
export function get(req, res) {
|
||||
if (!json || process.env.NODE_ENV !== 'production') {
|
||||
const { slug } = req.params;
|
||||
|
||||
locale.subscribe(localecode => {
|
||||
console.log('sublocale: ' + localecode, LANGUAGES);
|
||||
if (!LANGUAGES.includes(localecode)) {
|
||||
console.log(INIT_OPTIONS);
|
||||
localecode = INIT_OPTIONS.initialLocale || 'en';
|
||||
}
|
||||
json = JSON.stringify(generate_docs('docs/', slug, localecode)); // TODO it errors if I send the non-stringified value
|
||||
|
||||
const seo = generate_seo('docs/', slug, localecode);
|
||||
|
||||
// import(`../../../docs/${slug}/seo_${localecode}.jsonld`).then((module) => {
|
||||
// const seo = module.meta;
|
||||
// const docs = generate_docs('docs/', slug, localecode);
|
||||
// json = JSON.stringify({ docs, seo }); // TODO it errors if I send the non-stringified value
|
||||
// }).catch(error => {
|
||||
// console.error(error);
|
||||
|
||||
const docs = generate_docs('docs/', slug, localecode);
|
||||
json = JSON.stringify({ docs, seo }); // TODO it errors if I send the non-stringified value
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,42 @@
|
||||
<script context="module">
|
||||
export async function preload({params}) {
|
||||
const {lang, slug} = params;
|
||||
const sections = await this.fetch(`${slug}.json`).then(r => r.json());
|
||||
const tags = [];
|
||||
return { sections, slug, tags };
|
||||
const {docs, seo} = await this.fetch(`${slug}.json`).then(r => r.json());
|
||||
return { sections: docs, seo, slug };
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import DocsHeader from '../components/DocsHeader.svelte';
|
||||
import manifest from '../../static/manifest.json';
|
||||
import Docs from "../components/Docs.svelte";
|
||||
export let slug;
|
||||
export let sections;
|
||||
export let seo;
|
||||
import { onMount } from 'svelte';
|
||||
export let tags;
|
||||
import { initPhotoSwipeFromDOM } from '../utils/photoswipe.js';
|
||||
import SearchSelector from '../components/SearchSelector.svelte';
|
||||
|
||||
onMount(() => {
|
||||
initPhotoSwipeFromDOM('.zitadel-gallery');
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@media (min-width: 832px) {
|
||||
:global(main) {
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<svelte:head>
|
||||
<title>{manifest.name} • {slug}</title>
|
||||
|
||||
{#each tags as { name, content }, i}
|
||||
<meta name={name} content={content} />
|
||||
{/each}
|
||||
{ @html seo}
|
||||
</svelte:head>
|
||||
|
||||
<Docs {sections} project="zitadel/site" dir="{slug}"/>
|
||||
<DocsHeader {slug}></DocsHeader>
|
||||
<Docs {sections} project="zitadel/site" dir="{slug}"/>
|
||||
|
||||
<!-- <SearchSelector></SearchSelector> -->
|
||||
@@ -5,11 +5,16 @@
|
||||
import NavItem from "../components/NavItem.svelte";
|
||||
import manifest from '../../static/manifest.json';
|
||||
import PhotoSwipe from '../components/PhotoSwipe.svelte';
|
||||
|
||||
export let segment;
|
||||
const { page } = stores();
|
||||
</script>
|
||||
|
||||
<script context="module">
|
||||
import { waitLocale } from 'svelte-i18n';
|
||||
export async function preload(page) {
|
||||
return waitLocale();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
main {
|
||||
position: relative;
|
||||
@@ -19,7 +24,7 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Nav {segment} title="{manifest.name}" logo="logos/zitadel-logo-light.svg"></Nav>
|
||||
<!-- <Nav {segment} title="{manifest.name}" logo="logos/zitadel-logo-light.svg"></Nav> -->
|
||||
|
||||
<main>
|
||||
<slot />
|
||||
|
||||
+319
-32
@@ -7,33 +7,175 @@
|
||||
<script>
|
||||
import Split from "../components/Split.svelte";
|
||||
import Section from '../components/Section.svelte';
|
||||
import { _ } from 'svelte-i18n';
|
||||
import { _ , locale} from 'svelte-i18n';
|
||||
import LanguageSwitcher from '../components/LanguageSwitcher.svelte';
|
||||
import Nav from '../components/Nav.svelte';
|
||||
export let segment;
|
||||
import {LANGUAGES} from '../../config.js';
|
||||
import Button from '../components/Button.svelte';
|
||||
|
||||
function reload(language) {
|
||||
if (typeof window !== 'undefined') {
|
||||
locale.set(language);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
h2 {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.caos-back {
|
||||
position: absolute;
|
||||
top: 80px;
|
||||
height: 60vh;
|
||||
max-height: 500px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.section {
|
||||
width: 100%;
|
||||
margin-top: 70vh;
|
||||
min-height: 80vh;
|
||||
margin-top: 100px;
|
||||
}
|
||||
|
||||
.section .caos-back {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.subsection {
|
||||
display: block;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.subsection .getstarted-btn {
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.doc-container .doc {
|
||||
padding: 1.5rem;
|
||||
background: #2a2f45;
|
||||
border-radius: 10px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.doc-container .doc img{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.doc-container .doc .text{
|
||||
top: 180px;
|
||||
}
|
||||
|
||||
.doc-container .doc .text p{
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.doc-container .doc .text h4 {
|
||||
font-size: 20px;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.doc-container .doc .text .section{
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
margin: .5rem 0;
|
||||
}
|
||||
|
||||
.doc-container .doc a {
|
||||
display: block;
|
||||
font-size: 1.5rem;
|
||||
border: none;
|
||||
margin-bottom: 1rem;
|
||||
padding: 0;
|
||||
font-weight: 700;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.doc-container .doc a i {
|
||||
color: var(--prime);
|
||||
margin-left: .5rem;
|
||||
}
|
||||
|
||||
.doc-container .doc a:hover {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
padding: 0;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sublinks {
|
||||
display: block;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.sublinks .sublink {
|
||||
font-size: 15px;
|
||||
margin-right: 2rem;
|
||||
border: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sectionlinks {
|
||||
display: block;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.sectionlinks .link {
|
||||
font-size: 15px;
|
||||
font-size: 13px !important;
|
||||
margin-bottom: 4px !important;
|
||||
border: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
.caos-back {
|
||||
right: 0;
|
||||
height: 70vh;
|
||||
}
|
||||
.section {
|
||||
width: 50%;
|
||||
margin-top: 50px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.section .left,
|
||||
.section .caos-back {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.section .caos-back {
|
||||
display: block;
|
||||
margin: 50px;
|
||||
}
|
||||
|
||||
.doc-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -1rem;
|
||||
}
|
||||
|
||||
.doc-container .doc {
|
||||
display: flex;
|
||||
margin: 1rem;
|
||||
max-width: 500px;
|
||||
flex: 1 0 auto;
|
||||
max-height: 350px;
|
||||
}
|
||||
|
||||
.doc-container .doc img{
|
||||
display: block;
|
||||
width: 180px;
|
||||
height: auto;
|
||||
margin-left: 1rem;
|
||||
object-fit: cover;
|
||||
margin-right: -1.5rem;
|
||||
margin-top: -1.5rem;
|
||||
margin-bottom: -1.5rem;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
object-position: 0 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -42,25 +184,170 @@
|
||||
<title>
|
||||
ZITADEL • Documentation
|
||||
</title>
|
||||
</svelte:head>
|
||||
<title>{$_('title')}</title>
|
||||
<meta property="description" content="{$_('home_seo.description')}" />
|
||||
|
||||
<img class="caos-back" src="logos/zitadel-logo-solo-darkdesign.svg" alt="caos logo">
|
||||
<meta property="og:url" content="https://docs.zitadel.ch" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="{$_('home_seo.title')}" />
|
||||
<meta property="og:description" content="{$_('home_seo.description')}" />
|
||||
<meta property="og:image"
|
||||
content="https://www.zitadel.ch/zitadel-social-preview25.png" />
|
||||
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:site" content="@caos_ch">
|
||||
<meta name="twitter:title" content="{$_('home_seo.title')}" />
|
||||
<meta name="twitter:description" content="{$_('home_seo.description')}" />
|
||||
<meta name="twitter:image" content="https://www.zitadel.ch/zitadel-social-preview25.png">
|
||||
</svelte:head>
|
||||
<Nav {segment} title="Zitadel docs" logo="logos/zitadel-logo-light.svg"></Nav>
|
||||
|
||||
<Section>
|
||||
<div class="section">
|
||||
<h2>{$_('title')}</h2>
|
||||
<p>{$_('description')}</p>
|
||||
<p>{$_('description2')}</p>
|
||||
<p>{$_('description3')}</p>
|
||||
|
||||
<ul style="list-style-type: none;">
|
||||
<li><a href="/start" >{$_('startlink')}</a></li>
|
||||
<li><a href="/integrate" >{$_('integratelink')}</a></li>
|
||||
<li><a href="/administrate" >{$_('administratelink')}</a></li>
|
||||
<li><a href="/develop" >{$_('developlink')}</a></li>
|
||||
<li><a href="/documentation" >{$_('docslink')}</a></li>
|
||||
<li><a href="/use" >{$_('uselink')}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="left">
|
||||
<blockquote>
|
||||
<p>{$_('languagealsoavailable')}:
|
||||
{#each LANGUAGES as lang}
|
||||
{#if lang != $locale}
|
||||
<a href="/" on:click="{() => reload(lang)}" class="{lang == $locale ? 'current': ''}">{lang == 'de'? 'Deutsch (WIP)' : 'English'}</a>
|
||||
{/if}
|
||||
{/each}
|
||||
</p>
|
||||
</blockquote>
|
||||
<h2>{$_('title')}</h2>
|
||||
<p>{$_('description')}</p>
|
||||
<p>{$_('description2')}</p>
|
||||
<p>{$_('description3')}</p>
|
||||
</div>
|
||||
<img class="caos-back" src="logos/zitadel-logo-solo-darkdesign.svg" alt="caos logo">
|
||||
</div>
|
||||
|
||||
<div class="subsection">
|
||||
<h3>{$_('startlink')}</h3>
|
||||
<p>{$_('startlink_desc')}</p>
|
||||
|
||||
<a href="/start" class="getstarted-btn">
|
||||
<Button selected style="margin: 2rem 0;">
|
||||
{$_('startlink')}
|
||||
<i class="las la-arrow-right"></i>
|
||||
</Button>
|
||||
</a>
|
||||
{#if $locale == 'en'}
|
||||
<div class="sublinks">
|
||||
<a class="sublink" href="start#Use_ORBOS_to_install_ZITADEL">{$_('startlink_useorbos')}</a>
|
||||
<a class="sublink" href="start#Use_ORBOS_to_install_ZITADEL">{$_('startlink_setupapp')}</a>
|
||||
</div>
|
||||
{:else if $locale == 'de'}
|
||||
<div class="sublinks">
|
||||
<a class="sublink" href="start#Use_ORBOS_to_install_ZITADEL">{$_('startlink_useorbos')}</a>
|
||||
<a class="sublink" href="start#Use_ORBOS_to_install_ZITADEL">{$_('startlink_setupapp')}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="doc-container">
|
||||
<div class="doc">
|
||||
<div class="text">
|
||||
<h4>{$_('integratelink')}</h4>
|
||||
<p>{$_('integratelink_desc')}</p>
|
||||
<a href="/integrate">{$_('learnmore')}<i class="las la-arrow-right"></i></a>
|
||||
|
||||
{#if $locale == 'en'}
|
||||
<p class="section">{$_('inthissection')}</p>
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="integrate#Single_Page_Application">{$_('integratelink_spa')}</a>
|
||||
<a class="link" href="integrate#Server_Side_Application">{$_('integratelink_ssr')}</a>
|
||||
<a class="link" href="integrate#Mobile_App_Native_App">{$_('integratelink_nativeapp')}</a>
|
||||
</div>
|
||||
<!-- {:else if $locale == 'de'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="integrate#Single_Page_Application">{$_('integratelink_spa')}</a>
|
||||
<a class="link" href="integrate#Server_Side_Application">{$_('integratelink_ssr')}</a>
|
||||
<a class="link" href="integrate#Mobile_App_Native_App">{$_('integratelink_nativeapp')}</a>
|
||||
</div> -->
|
||||
{/if}
|
||||
</div>
|
||||
<img src="img/develop2.png" alt="Develop" />
|
||||
</div>
|
||||
|
||||
<div class="doc">
|
||||
<div class="text">
|
||||
<h4>{$_('administratelink')}</h4>
|
||||
<p>{$_('administratelink_desc')}</p>
|
||||
<a href="/administrate">{$_('learnmore')}<i class="las la-arrow-right"></i></a>
|
||||
|
||||
<p class="section">{$_('inthissection')}</p>
|
||||
|
||||
{#if $locale == 'en'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="administrate#Organisations">{$_('administratelink_orgs')}</a>
|
||||
<a class="link" href="administrate#Projects">{$_('administratelink_projects')}</a>
|
||||
</div>
|
||||
{:else if $locale == 'de'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="administrate#Organisationen">{$_('administratelink_orgs')}</a>
|
||||
<a class="link" href="administrate#Projekte">{$_('administratelink_projects')}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<img src="img/projects2.png" alt="Develop" />
|
||||
</div>
|
||||
|
||||
<div class="doc">
|
||||
<div class="text">
|
||||
<h4>{$_('developlink')}</h4>
|
||||
<p>{$_('developlink_desc')}</p>
|
||||
<a href="/develop">{$_('learnmore')}<i class="las la-arrow-right"></i></a>
|
||||
|
||||
<p class="section">{$_('inthissection')}</p>
|
||||
|
||||
{#if $locale == 'en'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="develop#Authentication_API">{$_('developlink_authapi')}</a>
|
||||
<a class="link" href="develop#Management_API">{$_('developlink_mgmtapi')}</a>
|
||||
<a class="link" href="develop#Admin_API">{$_('developlink_adminapi')}</a>
|
||||
</div>
|
||||
{:else if $locale == 'de'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="develop#Authentication_API">{$_('developlink_authapi')}</a>
|
||||
<a class="link" href="develop#Management_API">{$_('developlink_mgmtapi')}</a>
|
||||
<a class="link" href="develop#Admin_API">{$_('developlink_adminapi')}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="doc">
|
||||
<div class="text">
|
||||
<h4>{$_('docslink')}</h4>
|
||||
<p>{$_('docslink_desc')}</p>
|
||||
<a href="/documentation" >{$_('learnmore')}<i class="las la-arrow-right"></i></a>
|
||||
|
||||
<p class="section">{$_('inthissection')}</p>
|
||||
{#if $locale == 'en'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="documentation#Principles">{$_('docslink_principles')}</a>
|
||||
<a class="link" href="documentation#Architecture">{$_('docslink_architecture')}</a>
|
||||
<a class="link" href="documentation#OpenID_Connect_1_0_and_OAuth_2_0">{$_('docslink_oidc')}</a>
|
||||
</div>
|
||||
{:else if $locale == 'de'}
|
||||
<div class="sectionlinks">
|
||||
<a class="link" href="documentation#Prinzipien">{$_('docslink_principles')}</a>
|
||||
<a class="link" href="documentation#Architektur">{$_('docslink_architecture')}</a>
|
||||
<a class="link" href="documentation#OpenID_Connect_1_0_and_OAuth_2_0">{$_('docslink_oidc')}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="doc">
|
||||
<div class="text">
|
||||
<h4>{$_('uselink')}</h4>
|
||||
<p>{$_('uselink_desc')}</p>
|
||||
<a href="/use" >{$_('learnmore')}<i class="las la-arrow-right"></i></a>
|
||||
</div>
|
||||
|
||||
<img src="img/personal2.png" alt="Develop" />
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
Reference in New Issue
Block a user