web/src/layouts/Layout.astro

147 lines · 4439 bytes

  1---
  2import { ViewTransitions } from 'astro:transitions'
  3import NavBar from '@components/scafold/NavBar.astro';
  4import Footer from '@components/scafold/Footer.astro';
  5
  6interface Props {
  7	title?: string; // Page title
  8	description?: string; // Overide description tag
  9  keywords?: string; // Overide keywords tag
 10	hideNav?: boolean; // Don't show the navbar (just homepage)
 11	author?: string; // Author of the content
 12	customSchemaJson?: any; // Custom schema item
 13	breadcrumbs?: Array<{
 14		name: string;
 15		item: string;
 16	}>
 17}
 18
 19const {
 20	title='Awesome Privacy | The Ultimate List of Private Apps',
 21	description='Your guide to finding privacy-respecting alternatives to popular software and services.',
 22	keywords='security, privacy, awesome privacy, data collection, free software, open source, privacy tools, privacy respecting software',
 23	hideNav=false,
 24	author='Alicia Sykes',
 25	breadcrumbs,
 26	customSchemaJson,
 27} = Astro.props;
 28
 29const makeBreadcrumbs = () => {
 30	if (!breadcrumbs) return null;
 31	return {
 32			"@context": "https://schema.org",
 33			"@type": "BreadcrumbList",
 34			"itemListElement": breadcrumbs.map((breadcrumb, index) => ({
 35				"@type": "ListItem",
 36				"position": index + 1,
 37				"name": breadcrumb.name,
 38				"item": `https://awesome-privacy.xyz/${breadcrumb.item}`
 39			}))
 40	}
 41}
 42
 43const makeSearchLd = () => {
 44	return {
 45		"@context": "https://schema.org",
 46		"@type": "WebSite",
 47		"url": "https://awesome-privacy.xyz/",
 48		"potentialAction": [{
 49			"@type": "SearchAction",
 50			"target": {
 51				"@type": "EntryPoint",
 52				"urlTemplate": "https://awesome-privacy.xyz/search?q={search_term_string}"
 53			},
 54			"query-input": "required name=search_term_string"
 55		}]
 56	}
 57};
 58
 59---
 60
 61<!doctype html>
 62<html lang="en" data-theme="dark">
 63	<head>
 64
 65		<ViewTransitions />
 66		
 67		<!-- Core info -->
 68		<title>{title}</title>
 69		<meta name="description" content={description}>
 70		<meta name="keywords" content={keywords}>
 71		<meta name="author" content={author}>
 72
 73		<!-- Page info, viewport, Astro credit -->
 74		<meta charset="UTF-8" />
 75		<meta name="viewport" content="width=device-width, initial-scale=1.0">
 76		<meta name="generator" content={Astro.generator} />
 77		<meta name="robots" content="index, follow">
 78
 79		<!-- Icons and colors -->
 80		<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
 81		<link rel="icon" type="image/png" sizes="64x64" href="/favicon.png">
 82		<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
 83
 84		<!-- Social media meta tags (Open Graphh + Twitter) -->
 85		<meta property="og:site_name" content="Awesome Privacy">
 86		<meta property="og:type" content="website">
 87		<meta property="og:url" content="https://awesome-privacy.xyz">
 88		<meta property="og:title" content={title}>
 89		<meta property="og:description" content={description}>
 90		<meta property="og:image" content="https://awesome-privacy.xyz/banner.png">
 91		<meta name="twitter:card" content="summary_large_image">
 92		<meta name="twitter:url" content="https://awesome-privacy.xyz">
 93		<meta name="twitter:title" content={title}>
 94		<meta name="twitter:description" content={description}>
 95		<meta name="twitter:image" content="https://awesome-privacy.xyz/banner.png">
 96		<meta name="twitter:site" content="@Lissy_Sykes">
 97		<meta name="twitter:creator" content="@Lissy_Sykes">
 98
 99
100		<!-- Non-tracking hit counter -->
101		<script defer is:inline
102			type="text/partytown"
103			data-domain="awesome-privacy.xyz"
104			src="https://no-track.as93.net/js/script.js">
105		</script>
106
107		<!-- Schema.org markup for Google -->
108		{breadcrumbs && (
109			<script type="application/ld+json" set:html={JSON.stringify(makeBreadcrumbs())} />
110		)}
111		{customSchemaJson && (
112			<script type="application/ld+json" set:html={JSON.stringify(customSchemaJson)} />
113		)}
114		<script type="application/ld+json" set:html={JSON.stringify(makeSearchLd)} />
115	</head>
116	<body>
117		{!hideNav && <NavBar /> }
118		<slot />
119		<Footer />
120	</body>
121</html>
122
123<style is:global>
124	@import '../styles/values.css';
125	@import '../styles/typography.css';
126	</style>
127	
128
129<style is:global>
130
131	html {
132		::selection {
133			background: var(--accent);
134			color: var(--accent-fg);
135		}
136		scroll-behavior: smooth;
137	}
138	body {
139		margin: 0;
140		min-height: 100vh;
141		color: var(--foreground);
142		background: var(--background);
143		/* background: -webkit-radial-gradient(circle, var(--bg-gradient-comp-1) 0%, var(--bg-gradient-comp-2) 100%);
144		background: radial-gradient(circle, var(--bg-gradient-comp-1) 0%, var(--bg-gradient-comp-2) 100%); */
145	}
146	
147</style>