479 lines
16 KiB
Plaintext
479 lines
16 KiB
Plaintext
---
|
|
// BaseLayout.astro
|
|
// Primary layout component that provides the fundamental structure and styles for the site
|
|
|
|
interface Props {
|
|
title: string;
|
|
description?: string;
|
|
image?: string;
|
|
}
|
|
|
|
const {
|
|
title,
|
|
description = "ArgoBox Blog - Home Lab & DevOps Insights",
|
|
image = "/images/og-image.jpg" // Make sure this image exists in public/images/
|
|
} = Astro.props;
|
|
---
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
{/* Inline script to set initial theme and prevent FOUC */}
|
|
<script is:inline>
|
|
const getInitialTheme = () => {
|
|
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
|
return localStorage.getItem('theme');
|
|
}
|
|
if (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: light)').matches) {
|
|
return 'light';
|
|
}
|
|
return 'dark'; // Default to dark if no preference found
|
|
};
|
|
|
|
const theme = getInitialTheme();
|
|
|
|
if (theme === 'light') {
|
|
document.documentElement.classList.add('light-mode');
|
|
} else {
|
|
// No need to add 'dark-mode' class if dark is the default via CSS
|
|
// document.documentElement.classList.add('dark-mode');
|
|
}
|
|
|
|
// Optional: Set data attribute for easier CSS targeting if needed
|
|
// document.documentElement.setAttribute('data-theme', theme);
|
|
</script>
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>{title}</title>
|
|
<meta name="description" content={description} />
|
|
|
|
<!-- Theme initialization - Must be inline -->
|
|
<script is:inline>
|
|
// Initialize theme before page loads to prevent flash
|
|
const savedTheme = localStorage.getItem('theme');
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
if (savedTheme === 'light' || (!savedTheme && !prefersDark)) {
|
|
document.documentElement.classList.add('light-mode');
|
|
} else {
|
|
document.documentElement.classList.remove('light-mode');
|
|
}
|
|
</script>
|
|
|
|
<!-- OpenGraph/Social Media Meta Tags -->
|
|
<meta property="og:title" content={title} />
|
|
<meta property="og:description" content={description} />
|
|
<meta property="og:image" content={Astro.site ? new URL(image, Astro.site).href : image} /> <!-- Use absolute URL -->
|
|
<meta property="og:url" content={Astro.url} />
|
|
<meta property="og:type" content="website" />
|
|
|
|
<!-- Twitter Card data -->
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content={title}>
|
|
<meta name="twitter:description" content={description}>
|
|
<meta name="twitter:image" content={Astro.site ? new URL(image, Astro.site).href : image}> <!-- Use absolute URL -->
|
|
|
|
<!-- Fonts -->
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@100;300;400;600;700&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
|
|
<!-- Font Awesome -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
<link rel="manifest" href="/site.webmanifest" />
|
|
|
|
<!-- Theme CSS -->
|
|
<link rel="stylesheet" href="/src/styles/theme.css" />
|
|
|
|
<!-- Cytoscape Library for Knowledge Graph -->
|
|
<script src="https://unpkg.com/cytoscape@3.25.0/dist/cytoscape.min.js" is:inline></script>
|
|
|
|
<!-- Schema.org markup for Google -->
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "WebSite",
|
|
"name": "ArgoBox Blog",
|
|
"url": Astro.site ? new URL(Astro.url.pathname, Astro.site).href : Astro.url.href, // Use absolute URL
|
|
"description": description,
|
|
"author": {
|
|
"@type": "Person",
|
|
"name": "Daniel LaForce"
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<!-- Global CSS Variables & Base Styles -->
|
|
<style is:global>
|
|
:root {
|
|
/* Primary Colors */
|
|
--bg-primary: #0f1219;
|
|
--bg-secondary: #161a24;
|
|
--bg-tertiary: #1e2330;
|
|
--bg-code: #1a1e2a;
|
|
--text-primary: #e2e8f0;
|
|
--text-secondary: #a0aec0;
|
|
--text-tertiary: #718096;
|
|
|
|
/* Accent Colors */
|
|
--accent-primary: #06b6d4; /* Cyan */
|
|
--accent-secondary: #3b82f6; /* Blue */
|
|
--accent-tertiary: #8b5cf6; /* Violet */
|
|
|
|
/* Glow Effects */
|
|
--glow-primary: rgba(6, 182, 212, 0.2);
|
|
--glow-secondary: rgba(59, 130, 246, 0.2);
|
|
--glow-tertiary: rgba(139, 92, 246, 0.2);
|
|
|
|
/* Border Colors */
|
|
--border-primary: rgba(255, 255, 255, 0.1);
|
|
--border-secondary: rgba(255, 255, 255, 0.05);
|
|
|
|
/* Card Background */
|
|
--card-bg: rgba(24, 28, 44, 0.5); /* Slightly different from original */
|
|
--card-border: rgba(56, 189, 248, 0.2); /* Cyan border */
|
|
|
|
/* UI Element Colors */
|
|
--ui-element: #1e293b;
|
|
--ui-element-hover: #334155;
|
|
|
|
/* Container Paddings */
|
|
--container-padding: clamp(1rem, 5vw, 3rem);
|
|
|
|
/* Font Sizes */
|
|
--font-size-xs: 0.75rem;
|
|
--font-size-sm: 0.875rem;
|
|
--font-size-md: 1rem;
|
|
--font-size-lg: 1.125rem;
|
|
--font-size-xl: 1.25rem;
|
|
--font-size-2xl: 1.5rem;
|
|
--font-size-3xl: 1.875rem;
|
|
--font-size-4xl: 2.25rem;
|
|
--font-size-5xl: 3rem;
|
|
|
|
/* Font Families */
|
|
--font-mono: 'JetBrains Mono', monospace;
|
|
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
}
|
|
|
|
/* Reset Styles */
|
|
*, *::before, *::after {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
html, body {
|
|
height: 100%;
|
|
width: 100%;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
body {
|
|
font-family: var(--font-sans);
|
|
background-color: var(--bg-primary);
|
|
color: var(--text-primary);
|
|
font-size: var(--font-size-md);
|
|
line-height: 1.6;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
background-image:
|
|
radial-gradient(circle at 20% 35%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
|
|
radial-gradient(circle at 75% 15%, rgba(59, 130, 246, 0.05) 0%, transparent 45%),
|
|
radial-gradient(circle at 85% 70%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
|
|
position: relative;
|
|
}
|
|
|
|
/* Grid overlay effect */
|
|
body::before {
|
|
content: "";
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-image:
|
|
linear-gradient(rgba(226, 232, 240, 0.03) 1px, transparent 1px),
|
|
linear-gradient(90deg, rgba(226, 232, 240, 0.03) 1px, transparent 1px);
|
|
background-size: 30px 30px;
|
|
pointer-events: none;
|
|
z-index: -1;
|
|
}
|
|
|
|
a {
|
|
color: var(--accent-primary);
|
|
text-decoration: none;
|
|
transition: color 0.3s ease;
|
|
}
|
|
|
|
a:hover {
|
|
color: var(--accent-secondary);
|
|
}
|
|
|
|
img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
display: block; /* Prevent bottom space */
|
|
}
|
|
|
|
h1, h2, h3, h4, h5, h6 {
|
|
margin: 0 0 1rem 0;
|
|
line-height: 1.2;
|
|
font-weight: 600;
|
|
color: var(--text-primary); /* Ensure headings use primary text color */
|
|
}
|
|
|
|
p {
|
|
margin-bottom: 1.5rem;
|
|
color: var(--text-secondary); /* Use secondary for paragraphs */
|
|
}
|
|
|
|
button {
|
|
cursor: pointer;
|
|
border: none;
|
|
outline: none;
|
|
font-family: var(--font-sans);
|
|
}
|
|
|
|
.container {
|
|
max-width: 1280px;
|
|
margin: 0 auto;
|
|
padding: 0 var(--container-padding);
|
|
}
|
|
|
|
/* Neuronal nodes animation */
|
|
.neural-nodes { /* Changed from ID to class */
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
z-index: -1;
|
|
}
|
|
|
|
.neural-node {
|
|
position: absolute; /* Changed from fixed */
|
|
width: 2px;
|
|
height: 2px;
|
|
background: rgba(226, 232, 240, 0.2);
|
|
border-radius: 50%;
|
|
animation: pulse 4s infinite alternate ease-in-out;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0% {
|
|
transform: scale(1);
|
|
opacity: 0.3;
|
|
}
|
|
100% {
|
|
transform: scale(1.5);
|
|
opacity: 0.6;
|
|
}
|
|
}
|
|
|
|
/* Floating gradient shapes */
|
|
.floating-shapes {
|
|
position: fixed; /* Changed from absolute */
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
z-index: -1; /* Ensure it's behind content */
|
|
}
|
|
|
|
.floating-shape {
|
|
position: absolute;
|
|
border-radius: 50%;
|
|
opacity: 0.05;
|
|
filter: blur(30px);
|
|
}
|
|
|
|
.shape-1 {
|
|
width: 300px;
|
|
height: 300px;
|
|
background: var(--accent-primary);
|
|
top: 20%;
|
|
right: 0;
|
|
}
|
|
|
|
.shape-2 {
|
|
width: 200px;
|
|
height: 200px;
|
|
background: var(--accent-secondary);
|
|
bottom: 10%;
|
|
left: 10%;
|
|
}
|
|
|
|
.shape-3 {
|
|
width: 150px;
|
|
height: 150px;
|
|
background: var(--accent-tertiary);
|
|
top: 70%;
|
|
right: 20%;
|
|
}
|
|
|
|
/* Main Header (Example - Adapt if using Header.astro component) */
|
|
.site-header {
|
|
background: linear-gradient(180deg, var(--bg-secondary), transparent);
|
|
padding: 1.5rem 0;
|
|
position: relative; /* Changed from sticky if needed */
|
|
z-index: 10;
|
|
border-bottom: 1px solid var(--border-primary);
|
|
}
|
|
|
|
.header-container {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
max-width: 1280px;
|
|
margin: 0 auto;
|
|
padding: 0 var(--container-padding);
|
|
}
|
|
|
|
/* Footer (Example - Adapt if using Footer.astro component) */
|
|
.site-footer {
|
|
background: var(--bg-secondary);
|
|
padding: 4rem 0 2rem;
|
|
border-top: 1px solid var(--border-primary);
|
|
margin-top: 4rem; /* Add space above footer */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Neural Nodes Animation Container -->
|
|
<div class="neural-nodes"></div>
|
|
|
|
<!-- Floating Gradient Shapes Container -->
|
|
<div class="floating-shapes">
|
|
<div class="floating-shape shape-1"></div>
|
|
<div class="floating-shape shape-2"></div>
|
|
<div class="floating-shape shape-3"></div>
|
|
</div>
|
|
|
|
<slot name="header" />
|
|
|
|
<main>
|
|
<slot /> <!-- Default slot for page content -->
|
|
</main>
|
|
|
|
<slot name="footer" />
|
|
|
|
<!-- JavaScript for animations -->
|
|
<script>
|
|
// Create neural network nodes
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const nodesContainer = document.querySelector('.neural-nodes');
|
|
if (nodesContainer) { // Check if container exists
|
|
const nodeCount = 30; // Adjust count as needed
|
|
|
|
for (let i = 0; i < nodeCount; i++) {
|
|
const node = document.createElement('div');
|
|
node.classList.add('neural-node');
|
|
|
|
// Random positioning
|
|
node.style.left = `${Math.random() * 100}%`;
|
|
node.style.top = `${Math.random() * 100}%`;
|
|
|
|
// Random animation delay
|
|
node.style.animationDelay = `${Math.random() * 5}s`;
|
|
|
|
nodesContainer.appendChild(node);
|
|
}
|
|
} else {
|
|
console.warn("Element with class 'neural-nodes' not found.");
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<!-- Add copy to clipboard functionality for code blocks -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Find all code blocks
|
|
const codeBlocks = document.querySelectorAll('pre code');
|
|
|
|
// Add copy button to each
|
|
codeBlocks.forEach((codeBlock, index) => {
|
|
// Create container for copy button (to enable positioning)
|
|
const container = document.createElement('div');
|
|
container.className = 'code-block-container';
|
|
container.style.position = 'relative';
|
|
|
|
// Create copy button
|
|
const copyButton = document.createElement('button');
|
|
copyButton.className = 'copy-code-button';
|
|
copyButton.setAttribute('aria-label', 'Copy code to clipboard');
|
|
copyButton.innerHTML = `
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="copy-icon">
|
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
</svg>
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="check-icon" style="display: none;">
|
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
</svg>
|
|
`;
|
|
|
|
// Style the button
|
|
copyButton.style.position = 'absolute';
|
|
copyButton.style.top = '0.5rem';
|
|
copyButton.style.right = '0.5rem';
|
|
copyButton.style.padding = '0.25rem';
|
|
copyButton.style.background = 'rgba(45, 55, 72, 0.5)';
|
|
copyButton.style.border = '1px solid rgba(255, 255, 255, 0.2)';
|
|
copyButton.style.borderRadius = '0.25rem';
|
|
copyButton.style.cursor = 'pointer';
|
|
copyButton.style.zIndex = '10';
|
|
copyButton.style.opacity = '0';
|
|
copyButton.style.transition = 'opacity 0.2s';
|
|
|
|
// Add click handler
|
|
copyButton.addEventListener('click', () => {
|
|
// Get code text
|
|
const code = codeBlock.textContent;
|
|
|
|
// Copy to clipboard
|
|
navigator.clipboard.writeText(code).then(() => {
|
|
// Show success UI
|
|
copyButton.querySelector('.copy-icon').style.display = 'none';
|
|
copyButton.querySelector('.check-icon').style.display = 'block';
|
|
|
|
// Reset after 2 seconds
|
|
setTimeout(() => {
|
|
copyButton.querySelector('.copy-icon').style.display = 'block';
|
|
copyButton.querySelector('.check-icon').style.display = 'none';
|
|
}, 2000);
|
|
});
|
|
});
|
|
|
|
// Clone the code block
|
|
const preElement = codeBlock.parentElement;
|
|
const wrapper = preElement.parentElement;
|
|
|
|
// Create the container structure
|
|
container.appendChild(preElement.cloneNode(true));
|
|
container.appendChild(copyButton);
|
|
|
|
// Replace the original pre with our container
|
|
wrapper.replaceChild(container, preElement);
|
|
|
|
// Update the reference to the new code block
|
|
const newCodeBlock = container.querySelector('code');
|
|
|
|
// Add hover behavior
|
|
container.addEventListener('mouseenter', () => {
|
|
copyButton.style.opacity = '1';
|
|
});
|
|
|
|
container.addEventListener('mouseleave', () => {
|
|
copyButton.style.opacity = '0';
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |