Meta Angaben für Content-Seiten hinzugefügt.

This commit is contained in:
Mario Linz 2022-06-15 08:26:06 +02:00
parent ee7ed0db1f
commit 25a39dfac0
9 changed files with 192 additions and 116 deletions
api/collections
src
types

@ -37,6 +37,25 @@ meta:
- source: locale - source: locale
type: flag type: flag
tablist:
meta:
expand: general
tabs:
- name: general
meta:
label: { de: "Allgemein", en: "General" }
subFields:
- source: locale
- source: tags
- source: path
- source: priority
- name: meta
meta:
label: { de: "Meta", en: "Meta" }
source: meta
subFields:
- source: meta
imageFilter: imageFilter:
xs: xs:
- fit: true - fit: true
@ -110,6 +129,7 @@ fields:
- name: tags - name: tags
type: string[] type: string[]
meta: meta:
hideInRoot: true
helperText: helperText:
de: "Seiten können miteinander verknüpft werden. Entsprechende Seiten in einer anderen Sprache, die mit den selben zugewiesenen Schlagworten gekennzeichnet sind, können bei Umschaltung der Seitensprache gefunden werden. Wählen Sie einen existierenden Eintrag aus der Liste oder geben Sie ein neues Schlagwort ein und bestätigen mit Enter." de: "Seiten können miteinander verknüpft werden. Entsprechende Seiten in einer anderen Sprache, die mit den selben zugewiesenen Schlagworten gekennzeichnet sind, können bei Umschaltung der Seitensprache gefunden werden. Wählen Sie einen existierenden Eintrag aus der Liste oder geben Sie ein neues Schlagwort ein und bestätigen mit Enter."
en: "Pages can be linked together. Corresponding pages in another language, marked with the same assigned keywords, can be found by switching the page language. Select an existing entry from the list or enter a new keyword and confirm with Enter." en: "Pages can be linked together. Corresponding pages in another language, marked with the same assigned keywords, can be found by switching the page language. Select an existing entry from the list or enter a new keyword and confirm with Enter."
@ -121,7 +141,7 @@ fields:
choices: choices:
endpoint: "tags" endpoint: "tags"
mapping: mapping:
id: "id" id: "name"
name: "name" name: "name"
params: params:
sort: "name" sort: "name"
@ -129,6 +149,7 @@ fields:
type: string type: string
index: [single, unique] index: [single, unique]
meta: meta:
hideInRoot: true
label: { de: "Pfad", en: "Path" } label: { de: "Pfad", en: "Path" }
helperText: helperText:
de: "Der Pfad muss eindeutig sein und ohne ein Slash (/) beginnen und enden." de: "Der Pfad muss eindeutig sein und ohne ein Slash (/) beginnen und enden."
@ -136,6 +157,7 @@ fields:
- name: priority - name: priority
type: number type: number
meta: meta:
hideInRoot: true
defaultValue: [0] defaultValue: [0]
label: { de: "Priorität", en: "Priority" } label: { de: "Priorität", en: "Priority" }
helperText: helperText:
@ -148,3 +170,47 @@ fields:
# collapse: { titleFieldName: "article.content.title" } # collapse: { titleFieldName: "article.content.title" }
# subFields: # subFields:
# - !include fields/_article.yml # - !include fields/_article.yml
- name: meta
type: object
meta:
hideInRoot: true
subFields:
- name: metaTitle
type: string
meta:
label: { de: "Titel der Webseite", en: "Page Title" }
- name: metaDescription
type: string
meta:
label: { de: "Beschreibung der Webseite", en: "Page Description" }
- name: metaTagRobots
type: string[]
meta:
widget: chipArray
label:
de: Robots
en: Robots
defaultValue: []
autocomplete: true
choices:
- { id: "noindex", name: "noindex" }
- { id: "index", name: "index" }
- { id: "follow", name: "follow" }
- { id: "nofollow", name: "nofollow" }
- { id: "noimageindex", name: "noimageindex" }
- { id: "none", name: "none" }
- { id: "noarchive", name: "noarchive" }
- { id: "nocache", name: "nocache" }
- { id: "nosnippet", name: "nosnippet" }
- { id: "nnavailable_after", name: "nnavailable_after" }
helperText:
de: "<strong>Noindex</strong>: Weist eine Suchmaschine an, eine Seite nicht zu indizieren.<br/><strong>index</strong>: Weist eine Suchmaschine an, eine Seite zu indizieren. Beachten Sie, dass Sie dieses Meta-Tag nicht hinzufügen müssen; es ist die Voreinstellung.<br/><strong>follow</strong>: Auch wenn die Seite nicht indexiert ist, sollte der Crawler allen Links auf einer Seite folgen und Eigenkapital an die verlinkten Seiten weitergeben.<br/><strong>nofollow</strong>: Weist einen Crawler an, keinen Links auf einer Seite zu folgen oder Link-Equity weiterzugeben.<br/><strong>noimageindex</strong>: Weist einen Crawler an, keine Bilder auf einer Seite zu indizieren.<br/><strong>none</strong>: Entspricht der gleichzeitigen Verwendung der noindex- und nofollow-Tags.<br/><strong>noarchive</strong>: Suchmaschinen sollten keinen zwischengespeicherten Link zu dieser Seite auf einem SERP anzeigen.<br/><strong>nocache</strong>: Wie noarchive, aber nur von Internet Explorer und Firefox verwendet.<br/><strong>nosnippet</strong>: Weist eine Suchmaschine an, kein Snippet dieser Seite (d. h. Meta-Beschreibung) dieser Seite auf einem SERP anzuzeigen.<br/><strong>nnavailable_after</strong>: Suchmaschinen sollen diese Seite nach einem bestimmten Datum nicht mehr indexieren.<br/>"
en: "<strong>Noindex</strong>: Tells a search engine not to index a page.<br/><strong>index</strong>: Tells a search engine to index a page. Note that you dont need to add this meta tag; its the default.<br/><strong>follow</strong>: Even if the page isnt indexed, the crawler should follow all the links on a page and pass equity to the linked pages.<br/><strong>nofollow</strong>: Tells a crawler not to follow any links on a page or pass along any link equity.<br/><strong>noimageindex</strong>: Tells a crawler not to index any images on a page.<br/><strong>none</strong>: Equivalent to using both the noindex and nofollow tags simultaneously.<br/><strong>noarchive</strong>: Search engines should not show a cached link to this page on a SERP.<br/><strong>nocache</strong>: Same as noarchive, but only used by Internet Explorer and Firefox.<br/><strong>nosnippet</strong>: Tells a search engine not to show a snippet of this page (i.e. meta description) of this page on a SERP.<br/><strong>nnavailable_after</strong>: Search engines should no longer index this page after a particular date.<br/>"
- name: metaKeywords
type: string
meta:
label: { de: "SEO / Schlüsselwörter", en: "SEO / Keywords" }
helperText:
de: "Beispiel: Stichwort1, Stichwort2, Stichwort3"
en: "Example: keyword1, keyword2, keyword3"

@ -1,6 +1,7 @@
name: locale name: locale
type: string type: string
meta: meta:
hideInRoot: true
widget: select widget: select
label: { de: "Sprache", en: "Language" } label: { de: "Sprache", en: "Language" }
helperText: helperText:

@ -2,11 +2,10 @@
import { _ } from "svelte-i18n" import { _ } from "svelte-i18n"
import { Router, Route } from "svelte-routing" import { Router, Route } from "svelte-routing"
import { scrollToTop } from "svelte-scrollto" import { scrollToTop } from "svelte-scrollto"
import { generalInfo, location, currentLang } from "../store" import { location } from "../store"
import Home from "./routes/Home.svelte" import Home from "./routes/Home.svelte"
import Content from "./routes/Content.svelte" import Content from "./routes/Content.svelte"
import ArticleDetails from "./routes/ArticleDetails.svelte"
import Header from "./widgets/Header.svelte" import Header from "./widgets/Header.svelte"
import Footer from "./widgets/Footer.svelte" import Footer from "./widgets/Footer.svelte"
@ -32,33 +31,6 @@
if (typeof window !== "undefined") console.log("App initialized") if (typeof window !== "undefined") console.log("App initialized")
</script> </script>
<svelte:head>
{#if $generalInfo?.meta?.metaTitle}
<title>{$generalInfo?.meta?.metaTitle}</title>
{/if}
{#if $generalInfo?.meta?.metaDescription}
<meta name="description" content="{$generalInfo?.meta?.metaDescription}" />
{/if}
{#if $generalInfo?.meta?.metaKeywords}
<meta name="keywords" content="{$generalInfo?.meta?.metaKeywords.replaceAll(' ', '')}" />
{/if}
{#if $generalInfo?.person?.firstname || $generalInfo?.person?.lastname}
<meta
name="author"
content="{$generalInfo?.person?.firstname ? $generalInfo?.person?.firstname : ''} {$generalInfo?.person
?.lastname
? $generalInfo?.person?.lastname
: ''}"
/>
{/if}
{#if $generalInfo?.meta?.metaTagRobots}
<meta name="robots" content="{$generalInfo?.meta?.metaTagRobots}" />
{/if}
{#if $generalInfo?.media?.favicon}
<link rel="shortcut icon" type="image/x-icon" href="{$generalInfo?.media?.favicon.src}" />
{/if}
</svelte:head>
<Header /> <Header />
<Router url="{url}"> <Router url="{url}">

@ -80,61 +80,84 @@
</script> </script>
<svelte:head> <svelte:head>
<title>{content?.name ? content?.name + " - " : ""}{$generalInfo?.meta?.metaTitle}</title> <title
>{content?.name ? content?.name + " - " : ""}{content?.meta?.metaTitle
? content?.meta?.metaTitle
: $generalInfo?.meta?.metaTitle}</title
>
<meta
name="description"
content="{content?.meta?.metaDescription
? content?.meta?.metaDescription
: $generalInfo?.meta?.metaDescription}"
/>
<meta
name="keywords"
content="{content?.meta?.metaKeywords
? content?.meta?.metaKeywords.replaceAll(' ', '')
: $generalInfo?.meta?.metaKeywords.replaceAll(' ', '')}"
/>
<meta
name="robots"
content="{content?.meta?.metaTagRobots ? content?.meta?.metaTagRobots : $generalInfo?.meta?.metaTagRobots}"
/>
{#if $generalInfo?.person?.firstname || $generalInfo?.person?.lastname}
<meta
name="author"
content="{$generalInfo?.person?.firstname ? $generalInfo?.person?.firstname : ''} {$generalInfo?.person
?.lastname
? $generalInfo?.person?.lastname
: ''}"
/>
{/if}
</svelte:head> </svelte:head>
<div class="container"> {#if loading}
<div class="row"> <!-- Loader -->
<div class="col-md-12"> {:else if content}
{#if loading} <!--
<!-- Loader --> {#each content.blocks || [] as b}
{:else if content} {JSON.stringify(b)}
<!-- {/each}
{#each content.blocks || [] as b} -->
{JSON.stringify(b)} <ArticlesList path="{path}" tags="{content?.tags}" />
{/each} {:else}
--> <div class="page-404">
<ArticlesList path="{path}" /> <div>
{:else} <Image
<div class="page-404"> collectionName="general"
<div> entryId="{$generalInfo.id}"
<Image file="{$generalInfo?.media?.brand}"
collectionName="general" alt="{$generalInfo?.meta?.metaTitle}"
entryId="{$generalInfo.id}" cssClass="brand"
file="{$generalInfo?.media?.brand}" />
alt="{$generalInfo?.meta?.metaTitle}"
cssClass="brand"
/>
</div>
<h1>{$_("pageNotFound")}</h1>
<p class="mb-md">
{#if connectedContentNotFound}
<div>
{@html $_("connectedContentNotFound", {
values: {
url: currentDomain + "/" + path,
lang: $_($currentLang) + ` (${$currentLang})`,
},
})}
</div>
{:else}
<strong>
<a href="{currentDomain + '/' + path}">{currentDomain + "/" + path}</a>
</strong>
{/if}
</p>
<p>
{@html $_("pageNotFoundInformation", {
values: {
url: currentDomain,
backUrl: currentDomain + "/" + path,
},
})}
</p>
</div>
{/if}
</div> </div>
<h1>{$_("pageNotFound")}</h1>
<p class="mb-md">
{#if connectedContentNotFound}
<div>
{@html $_("connectedContentNotFound", {
values: {
url: currentDomain + "/" + path,
lang: $_($currentLang) + ` (${$currentLang})`,
},
})}
</div>
{:else}
<strong>
<a href="{currentDomain + '/' + path}">{currentDomain + "/" + path}</a>
</strong>
{/if}
</p>
<p>
{@html $_("pageNotFoundInformation", {
values: {
url: currentDomain,
backUrl: currentDomain + "/" + path,
},
})}
</p>
</div> </div>
</div> {/if}

@ -1,41 +1,51 @@
<script lang="ts"> <script lang="ts">
import * as animateScroll from "svelte-scrollto" import * as animateScroll from "svelte-scrollto"
import GoogleMaps from "../widgets/GoogleMaps.svelte" import { generalInfo } from "../../store"
// import ContactForm from "../widgets/ContactForm.svelte"
// import GoogleMaps from "../widgets/GoogleMaps.svelte"
import ScrollTo from "../widgets/ScrollTo.svelte" import ScrollTo from "../widgets/ScrollTo.svelte"
import ContactForm from "../widgets/ContactForm.svelte"
import GeneralMediaImage from "../widgets/GeneralMediaImage.svelte" import GeneralMediaImage from "../widgets/GeneralMediaImage.svelte"
import ArticlesList from "../widgets/ArticlesList.svelte" import ArticlesList from "../widgets/ArticlesList.svelte"
let expandedForm: string = "recipe" let expandedForm: string = "recipe"
</script> </script>
<section class="contact"> <svelte:head>
<div class="container"> {#if $generalInfo?.meta?.metaTitle}
<div class="row"> <title>{$generalInfo?.meta?.metaTitle}</title>
<div class="col-md-12"> {/if}
<ArticlesList tag="home" /> {#if $generalInfo?.meta?.metaDescription}
</div> <meta name="description" content="{$generalInfo?.meta?.metaDescription}" />
</div> {/if}
<div class="row"> {#if $generalInfo?.meta?.metaKeywords}
<div class="col-md-12"> <meta name="keywords" content="{$generalInfo?.meta?.metaKeywords.replaceAll(' ', '')}" />
<GeneralMediaImage id="test1" /> {/if}
</div> {#if $generalInfo?.person?.firstname || $generalInfo?.person?.lastname}
</div> <meta
<div class="row nospace"> name="author"
<div class="col-md-6"> content="{$generalInfo?.person?.firstname ? $generalInfo?.person?.firstname : ''} {$generalInfo?.person
<ContactForm type="recipe" collapsed="{expandedForm !== 'recipe'}" /> ?.lastname
</div> ? $generalInfo?.person?.lastname
<div class="col-md-6"> : ''}"
<ContactForm type="contact" collapsed="{expandedForm !== 'contact'}" /> />
</div> {/if}
</div> {#if $generalInfo?.meta?.metaTagRobots && $generalInfo?.meta?.metaTagRobots.length}
</div> <meta name="robots" content="{$generalInfo?.meta?.metaTagRobots}" />
</section> {/if}
{#if $generalInfo?.media?.favicon}
<link rel="shortcut icon" type="image/x-icon" href="{$generalInfo?.media?.favicon.src}" />
{/if}
</svelte:head>
<section> <ArticlesList tags="{['home']}" />
<GoogleMaps />
</section> <GeneralMediaImage id="test1" />
<!-- <ContactForm type="recipe" collapsed="{expandedForm !== 'recipe'}" /> -->
<!-- <ContactForm type="contact" collapsed="{expandedForm !== 'contact'}" /> -->
<!-- <GoogleMaps /> -->
<ScrollTo <ScrollTo
on:scrollTo="{(e) => { on:scrollTo="{(e) => {

@ -4,7 +4,7 @@
import Article from "../widgets/Article.svelte" import Article from "../widgets/Article.svelte"
export let tag: string = null export let tags: string[] = null
export let path: string = null export let path: string = null
let articleEntries: CollectionEntry[] = [] let articleEntries: CollectionEntry[] = []
@ -14,8 +14,8 @@
"article.general.locale": $currentLang, "article.general.locale": $currentLang,
} }
if (tag) { if (tags && tags?.length) {
filter["article.general.tags"] = { $in: [tag] } filter["article.general.tags"] = { $in: tags }
} }
if (path) { if (path) {

@ -1,7 +1,8 @@
article, article,
.article { .article {
overflow-wrap: anywhere; overflow-wrap: anywhere;
// border: 1px dashed @on-background; border: 1px dashed @on-background;
padding: 2px;
& ~ article, & ~ article,
& ~ .article { & ~ .article {

@ -6,7 +6,7 @@
@primary: #ff0000; @primary: #ff0000;
@on-primary: #fff; @on-primary: #fff;
@secondary: #1e7c9e; @secondary: #4e5d64;
@on-secondary: #ffffff; @on-secondary: #ffffff;
@surface: #fff; @surface: #fff;

3
types/global.d.ts vendored

@ -28,6 +28,9 @@ interface Content {
path: string path: string
name: string name: string
blocks?: ContentBlock[] blocks?: ContentBlock[]
meta: {
[key: string]: any
}
} }
interface GeneralInfo { interface GeneralInfo {