fresh-main #8
|
@ -192,7 +192,7 @@ const nodeTypeCounts = {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="full-post-footer">
|
<div class="full-post-footer">
|
||||||
<a href="#" id="full-post-link" class="full-post-link" target="_self" rel="noopener noreferrer">
|
<a href="#" id="full-post-link" class="full-post-link" target="_blank" rel="noopener noreferrer"> <!-- Changed target to _blank -->
|
||||||
Read Full Article
|
Read Full Article
|
||||||
<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">
|
<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">
|
||||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
|
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
|
||||||
|
@ -878,42 +878,7 @@ const nodeTypeCounts = {
|
||||||
// Reset graph view if "All" is selected
|
// Reset graph view if "All" is selected
|
||||||
cy.elements().removeClass('highlighted faded filtered');
|
cy.elements().removeClass('highlighted faded filtered');
|
||||||
const allFilterBtn = document.querySelector('.graph-filter[data-filter="all"]');
|
const allFilterBtn = document.querySelector('.graph-filter[data-filter="all"]');
|
||||||
// Add event listener to prevent redirect in fullscreen mode
|
// Listen for ESC key to exit fullscreen
|
||||||
if (fullPostLink) {
|
|
||||||
fullPostLink.addEventListener('click', (e) => {
|
|
||||||
if (isFullscreen) {
|
|
||||||
// If in fullscreen, prevent default behavior to keep the user in the graph view
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
// Instead, display a message to exit fullscreen to visit the full article
|
|
||||||
const message = document.createElement('div');
|
|
||||||
message.className = 'fullscreen-message';
|
|
||||||
message.textContent = 'Exit fullscreen to visit the full article page';
|
|
||||||
message.style.position = 'absolute';
|
|
||||||
message.style.bottom = '70px'; // Adjust as needed
|
|
||||||
message.style.left = '50%';
|
|
||||||
message.style.transform = 'translateX(-50%)';
|
|
||||||
message.style.background = 'rgba(0, 0, 0, 0.75)';
|
|
||||||
message.style.color = 'white';
|
|
||||||
message.style.padding = '8px 16px';
|
|
||||||
message.style.borderRadius = '4px';
|
|
||||||
message.style.zIndex = '1000';
|
|
||||||
message.style.transition = 'opacity 0.3s ease';
|
|
||||||
|
|
||||||
fullPostContent.appendChild(message);
|
|
||||||
|
|
||||||
// Remove the message after 3 seconds
|
|
||||||
setTimeout(() => {
|
|
||||||
message.style.opacity = '0';
|
|
||||||
setTimeout(() => {
|
|
||||||
message.remove();
|
|
||||||
}, 300);
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for ESC key to exit fullscreen
|
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Escape' && isFullscreen) {
|
if (e.key === 'Escape' && isFullscreen) {
|
||||||
toggleFullscreen();
|
toggleFullscreen();
|
||||||
|
@ -958,41 +923,6 @@ const nodeTypeCounts = {
|
||||||
// Dispatch graphReady event for external listeners
|
// Dispatch graphReady event for external listeners
|
||||||
document.dispatchEvent(new CustomEvent('graphReady', { detail: { cy } }));
|
document.dispatchEvent(new CustomEvent('graphReady', { detail: { cy } }));
|
||||||
|
|
||||||
// Add event listener to prevent redirect in fullscreen mode
|
|
||||||
if (fullPostLink) {
|
|
||||||
fullPostLink.addEventListener('click', (e) => {
|
|
||||||
if (isFullscreen) {
|
|
||||||
// If in fullscreen, prevent default behavior to keep the user in the graph view
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
// Instead, display a message to exit fullscreen to visit the full article
|
|
||||||
const message = document.createElement('div');
|
|
||||||
message.className = 'fullscreen-message';
|
|
||||||
message.textContent = 'Exit fullscreen to visit the full article page';
|
|
||||||
message.style.position = 'absolute';
|
|
||||||
message.style.bottom = '70px'; // Adjust as needed
|
|
||||||
message.style.left = '50%';
|
|
||||||
message.style.transform = 'translateX(-50%)';
|
|
||||||
message.style.background = 'rgba(0, 0, 0, 0.75)';
|
|
||||||
message.style.color = 'white';
|
|
||||||
message.style.padding = '8px 16px';
|
|
||||||
message.style.borderRadius = '4px';
|
|
||||||
message.style.zIndex = '1000';
|
|
||||||
message.style.transition = 'opacity 0.3s ease';
|
|
||||||
|
|
||||||
fullPostContent.appendChild(message);
|
|
||||||
|
|
||||||
// Remove the message after 3 seconds
|
|
||||||
setTimeout(() => {
|
|
||||||
message.style.opacity = '0';
|
|
||||||
setTimeout(() => {
|
|
||||||
message.remove();
|
|
||||||
}, 300);
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for ESC key to exit fullscreen
|
// Listen for ESC key to exit fullscreen
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Escape' && isFullscreen) {
|
if (e.key === 'Escape' && isFullscreen) {
|
||||||
|
|
|
@ -8,6 +8,8 @@ interface Props {
|
||||||
title: string; // Current post title
|
title: string; // Current post title
|
||||||
tags?: string[]; // Current post tags
|
tags?: string[]; // Current post tags
|
||||||
category?: string; // Current post category
|
category?: string; // Current post category
|
||||||
|
relatedPosts?: any[]; // Related posts data
|
||||||
|
allPosts?: any[]; // All posts for second level relationships
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract props with defaults
|
// Extract props with defaults
|
||||||
|
@ -15,34 +17,127 @@ const {
|
||||||
slug,
|
slug,
|
||||||
title,
|
title,
|
||||||
tags = [],
|
tags = [],
|
||||||
category = "Uncategorized"
|
category = "Uncategorized",
|
||||||
|
relatedPosts = [],
|
||||||
|
allPosts = []
|
||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
|
|
||||||
// Generate unique ID for the graph container
|
// Generate unique ID for the graph container
|
||||||
const graphId = `graph-${Math.random().toString(36).substring(2, 8)}`;
|
const graphId = `graph-${Math.random().toString(36).substring(2, 8)}`;
|
||||||
|
|
||||||
// Prepare simple graph data for just the post and its tags
|
// Get all unique tags from related posts (Level 1 tags)
|
||||||
|
const relatedPostsTags = relatedPosts
|
||||||
|
.flatMap(post => post.data.tags || [])
|
||||||
|
.filter(tag => !tags.includes(tag)); // Exclude current post tags to avoid duplicates
|
||||||
|
|
||||||
|
// Get Level 2 posts: posts related to Level 1 tags (excluding current post and Level 1 posts)
|
||||||
|
const level2PostIds = new Set();
|
||||||
|
const level2Posts = [];
|
||||||
|
|
||||||
|
// For each Level 1 tag, find related posts
|
||||||
|
tags.forEach(tag => {
|
||||||
|
allPosts.forEach(post => {
|
||||||
|
// Skip if post is current post or already in related posts
|
||||||
|
if (post.slug === slug || relatedPosts.some(rp => rp.slug === post.slug)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If post has the tag and isn't already added
|
||||||
|
if (post.data.tags?.includes(tag) && !level2PostIds.has(post.slug)) {
|
||||||
|
level2PostIds.add(post.slug);
|
||||||
|
level2Posts.push(post);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get Level 2 tags from Level 2 posts
|
||||||
|
const level2Tags = new Set();
|
||||||
|
level2Posts.forEach(post => {
|
||||||
|
(post.data.tags || []).forEach(tag => {
|
||||||
|
// Only add if not already in Level 0 or Level 1 tags
|
||||||
|
if (!tags.includes(tag) && !relatedPostsTags.includes(tag)) {
|
||||||
|
level2Tags.add(tag);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Prepare nodes data with different levels
|
||||||
const nodes = [
|
const nodes = [
|
||||||
// Current post node
|
// Level 0: Current post node
|
||||||
{
|
{
|
||||||
id: slug,
|
id: slug,
|
||||||
label: title,
|
label: title,
|
||||||
type: "post"
|
type: "post",
|
||||||
|
level: 0
|
||||||
},
|
},
|
||||||
// Tag nodes
|
// Level 1: Tag nodes
|
||||||
...tags.map(tag => ({
|
...tags.map(tag => ({
|
||||||
id: `tag-${tag}`,
|
id: `tag-${tag}`,
|
||||||
label: tag,
|
label: tag,
|
||||||
type: "tag"
|
type: "tag",
|
||||||
|
level: 1
|
||||||
|
})),
|
||||||
|
// Level 1: Related post nodes
|
||||||
|
...relatedPosts.map(post => ({
|
||||||
|
id: post.slug,
|
||||||
|
label: post.data.title,
|
||||||
|
type: "post",
|
||||||
|
level: 1
|
||||||
|
})),
|
||||||
|
// Level 2: Related tags nodes
|
||||||
|
...relatedPostsTags.map(tag => ({
|
||||||
|
id: `tag-${tag}`,
|
||||||
|
label: tag,
|
||||||
|
type: "tag",
|
||||||
|
level: 2
|
||||||
|
})),
|
||||||
|
// Level 2: Posts related to tags
|
||||||
|
...level2Posts.map(post => ({
|
||||||
|
id: post.slug,
|
||||||
|
label: post.data.title,
|
||||||
|
type: "post",
|
||||||
|
level: 2
|
||||||
|
})),
|
||||||
|
// Level 2: Tags from Level 2 posts
|
||||||
|
...[...level2Tags].map(tag => ({
|
||||||
|
id: `tag-${tag}`,
|
||||||
|
label: tag.toString(),
|
||||||
|
type: "tag",
|
||||||
|
level: 2
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
|
||||||
// Create edges connecting post to tags
|
// Create edges connecting nodes
|
||||||
const edges = tags.map(tag => ({
|
const edges = [
|
||||||
source: slug,
|
// Level 0 to Level 1: Current post to its tags
|
||||||
target: `tag-${tag}`,
|
...tags.map(tag => ({
|
||||||
type: "post-tag"
|
source: slug,
|
||||||
}));
|
target: `tag-${tag}`,
|
||||||
|
type: "post-tag"
|
||||||
|
})),
|
||||||
|
// Level 0 to Level 1: Current post to related posts
|
||||||
|
...relatedPosts.map(post => ({
|
||||||
|
source: slug,
|
||||||
|
target: post.slug,
|
||||||
|
type: "post-related"
|
||||||
|
})),
|
||||||
|
// Level 1 to Level 2: Related posts to their tags
|
||||||
|
...relatedPosts.flatMap(post =>
|
||||||
|
(post.data.tags || []).map(tag => ({
|
||||||
|
source: post.slug,
|
||||||
|
target: `tag-${tag}`,
|
||||||
|
type: "post-tag"
|
||||||
|
}))
|
||||||
|
),
|
||||||
|
// Level 1 to Level 2: Tags to related posts
|
||||||
|
...level2Posts.flatMap(post =>
|
||||||
|
tags.filter(tag => post.data.tags?.includes(tag)).map(tag => ({
|
||||||
|
source: `tag-${tag}`,
|
||||||
|
target: post.slug,
|
||||||
|
type: "tag-post"
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
// Prepare graph data object
|
// Prepare graph data object
|
||||||
const graphData = { nodes, edges };
|
const graphData = { nodes, edges };
|
||||||
|
@ -69,7 +164,7 @@ const graphData = { nodes, edges };
|
||||||
|
|
||||||
.mini-graph-container {
|
.mini-graph-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200px;
|
aspect-ratio: 1 / 1; /* Create square aspect ratio */
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid var(--card-border, rgba(56, 189, 248, 0.2));
|
border: 1px solid var(--card-border, rgba(56, 189, 248, 0.2));
|
||||||
|
@ -125,7 +220,8 @@ const graphData = { nodes, edges };
|
||||||
data: {
|
data: {
|
||||||
id: node.id,
|
id: node.id,
|
||||||
label: node.label,
|
label: node.label,
|
||||||
type: node.type
|
type: node.type,
|
||||||
|
level: node.level
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
...graphData.edges.map((edge, index) => ({
|
...graphData.edges.map((edge, index) => ({
|
||||||
|
@ -155,47 +251,104 @@ const graphData = { nodes, edges };
|
||||||
'text-max-width': '60px'
|
'text-max-width': '60px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Post node style
|
// Current post node style (Level 0)
|
||||||
{
|
{
|
||||||
selector: 'node[type="post"]',
|
selector: 'node[type="post"][level=0]',
|
||||||
style: {
|
style: {
|
||||||
'background-color': '#06B6D4',
|
'background-color': '#06B6D4',
|
||||||
'width': 30,
|
'width': 30,
|
||||||
'height': 30,
|
'height': 30,
|
||||||
'font-size': '9px',
|
'font-size': '9px',
|
||||||
'text-max-width': '80px'
|
'text-max-width': '80px',
|
||||||
|
'border-width': 2,
|
||||||
|
'border-color': '#38BDF8'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Tag node style
|
// Related post node style (Level 1)
|
||||||
{
|
{
|
||||||
selector: 'node[type="tag"]',
|
selector: 'node[type="post"][level=1]',
|
||||||
|
style: {
|
||||||
|
'background-color': '#3B82F6',
|
||||||
|
'width': 25,
|
||||||
|
'height': 25,
|
||||||
|
'font-size': '8px'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Distant post node style (Level 2)
|
||||||
|
{
|
||||||
|
selector: 'node[type="post"][level=2]',
|
||||||
|
style: {
|
||||||
|
'background-color': '#60A5FA',
|
||||||
|
'width': 20,
|
||||||
|
'height': 20,
|
||||||
|
'font-size': '7px',
|
||||||
|
'opacity': 0.8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Primary tag node style (Level 1)
|
||||||
|
{
|
||||||
|
selector: 'node[type="tag"][level=1]',
|
||||||
style: {
|
style: {
|
||||||
'background-color': '#10B981',
|
'background-color': '#10B981',
|
||||||
'shape': 'diamond',
|
'shape': 'diamond',
|
||||||
'width': 18,
|
'width': 20,
|
||||||
'height': 18
|
'height': 20
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Edge style
|
// Secondary tag node style (Level 2)
|
||||||
{
|
{
|
||||||
selector: 'edge',
|
selector: 'node[type="tag"][level=2]',
|
||||||
style: {
|
style: {
|
||||||
'width': 1,
|
'background-color': '#34D399',
|
||||||
'line-color': 'rgba(16, 185, 129, 0.6)',
|
'shape': 'diamond',
|
||||||
|
'width': 15,
|
||||||
|
'height': 15,
|
||||||
|
'opacity': 0.8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Direct edge style
|
||||||
|
{
|
||||||
|
selector: 'edge[type="post-tag"]',
|
||||||
|
style: {
|
||||||
|
'width': 1.5,
|
||||||
|
'line-color': 'rgba(16, 185, 129, 0.7)',
|
||||||
|
'line-style': 'solid',
|
||||||
|
'curve-style': 'bezier',
|
||||||
|
'opacity': 0.8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Related post edge style
|
||||||
|
{
|
||||||
|
selector: 'edge[type="post-related"]',
|
||||||
|
style: {
|
||||||
|
'width': 1.5,
|
||||||
|
'line-color': 'rgba(59, 130, 246, 0.7)',
|
||||||
'line-style': 'dashed',
|
'line-style': 'dashed',
|
||||||
'curve-style': 'bezier',
|
'curve-style': 'bezier',
|
||||||
'opacity': 0.7
|
'opacity': 0.8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Secondary connections
|
||||||
|
{
|
||||||
|
selector: 'edge[type="tag-post"]',
|
||||||
|
style: {
|
||||||
|
'width': 1,
|
||||||
|
'line-color': 'rgba(16, 185, 129, 0.4)',
|
||||||
|
'line-style': 'dotted',
|
||||||
|
'curve-style': 'bezier',
|
||||||
|
'opacity': 0.6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// Simple layout for small space
|
// Improved layout for multi-level visualization
|
||||||
layout: {
|
layout: {
|
||||||
name: 'concentric',
|
name: 'concentric', // NOTE: This is concentric, not cose as requested earlier
|
||||||
concentric: function(node) {
|
concentric: function(node) {
|
||||||
return node.data('type') === 'post' ? 10 : 1;
|
// Use node level for concentric layout
|
||||||
|
return 10 - node.data('level') * 3;
|
||||||
},
|
},
|
||||||
levelWidth: function() { return 1; },
|
levelWidth: function() { return 2; },
|
||||||
minNodeSpacing: 50,
|
minNodeSpacing: 40,
|
||||||
animate: false
|
animate: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -207,6 +360,12 @@ const graphData = { nodes, edges };
|
||||||
window.location.href = `/tag/${tagName}`;
|
window.location.href = `/tag/${tagName}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cy.on('tap', 'node[type="post"][level!=0]', function(evt) {
|
||||||
|
const node = evt.target;
|
||||||
|
const postSlug = node.id();
|
||||||
|
window.location.href = `/posts/${postSlug}/`;
|
||||||
|
});
|
||||||
|
|
||||||
// Fit graph to container
|
// Fit graph to container
|
||||||
cy.fit(undefined, 20);
|
cy.fit(undefined, 20);
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
---
|
---
|
||||||
title: Secure Remote Access with Cloudflare Tunnels
|
title: This is a test
|
||||||
description: How to set up Cloudflare Tunnels for secure remote access to your home lab services
|
description: How to set up Cloudflare Tunnels for secure remote access to your home lab services
|
||||||
pubDate: Jul 22 2023
|
pubDate: Jul 22 2023
|
||||||
heroImage: /images/posts/prometheusk8.png
|
heroImage: /images/posts/prometheusk8.png
|
||||||
category: networking
|
category: networking
|
||||||
tags:
|
tags:
|
||||||
- cloudflare
|
- Tag A
|
||||||
- networking
|
- Tag B
|
||||||
- security
|
- Tag C
|
||||||
- homelab
|
|
||||||
- tunnels
|
|
||||||
readTime: "7 min read"
|
readTime: "7 min read"
|
||||||
---
|
---
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
import BaseLayout from './BaseLayout.astro';
|
import BaseLayout from './BaseLayout.astro';
|
||||||
import Header from '../components/Header.astro';
|
import Header from '../components/Header.astro';
|
||||||
import Footer from '../components/Footer.astro';
|
import Footer from '../components/Footer.astro';
|
||||||
import MiniKnowledgeGraph from '../components/MiniKnowledgeGraph.astro'; // Restore original or keep if needed
|
// import MiniKnowledgeGraph from '../components/MiniKnowledgeGraph.astro'; // Keep if needed elsewhere, but remove from main content
|
||||||
|
import MiniGraph from '../components/MiniGraph.astro'; // Add import for MiniGraph
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -137,11 +138,11 @@ const displayImage = frontmatter.heroImage || '/images/placeholders/default.jpg'
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Content Connections - Knowledge Graph */}
|
{/* Content Connections - Removed MiniKnowledgeGraph from here */}
|
||||||
<div class="content-connections">
|
{/* <div class="content-connections">
|
||||||
<h3 class="connections-title">Post Connections</h3>
|
<h3 class="connections-title">Post Connections</h3>
|
||||||
<MiniKnowledgeGraph currentPost={currentPost} relatedPosts={relatedPosts} />
|
<MiniKnowledgeGraph currentPost={currentPost} relatedPosts={relatedPosts} />
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
{/* Main Content Area */}
|
{/* Main Content Area */}
|
||||||
<div class="blog-post-content prose prose-invert max-w-none">
|
<div class="blog-post-content prose prose-invert max-w-none">
|
||||||
|
@ -194,6 +195,24 @@ const displayImage = frontmatter.heroImage || '/images/placeholders/default.jpg'
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* MiniGraph Component - Placed after Author Card */}
|
||||||
|
<MiniGraph
|
||||||
|
slug={slug}
|
||||||
|
title={frontmatter.title}
|
||||||
|
tags={frontmatter.tags}
|
||||||
|
category={frontmatter.category}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Tags Section - Placed after MiniGraph */}
|
||||||
|
<div class="sidebar-card">
|
||||||
|
<h3 class="sidebar-title">Tags</h3>
|
||||||
|
<div class="tags">
|
||||||
|
{frontmatter.tags && frontmatter.tags.map(tag => (
|
||||||
|
<a href={`/tag/${tag}`} class="tag">{tag}</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Table of Contents Card */}
|
{/* Table of Contents Card */}
|
||||||
<div class="sidebar-card toc-card">
|
<div class="sidebar-card toc-card">
|
||||||
<h3>Table of Contents</h3>
|
<h3>Table of Contents</h3>
|
||||||
|
@ -306,6 +325,37 @@ const displayImage = frontmatter.heroImage || '/images/placeholders/default.jpg'
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add styles for Tags in the sidebar */
|
||||||
|
.tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
color: var(--accent-secondary);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
background-color: rgba(59, 130, 246, 0.1);
|
||||||
|
padding: 0.3rem 0.6rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag:hover {
|
||||||
|
color: var(--accent-primary);
|
||||||
|
background-color: rgba(6, 182, 212, 0.15);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
|
@ -2,6 +2,7 @@
|
||||||
// src/pages/posts/[slug].astro
|
// src/pages/posts/[slug].astro
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||||
|
import MiniGraph from '../../components/MiniGraph.astro';
|
||||||
|
|
||||||
// Required getStaticPaths function for dynamic routes
|
// Required getStaticPaths function for dynamic routes
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
|
@ -144,18 +145,41 @@ const { Content } = await post.render();
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{post.data.heroImage && (
|
|
||||||
<div class="hero-image">
|
|
||||||
<img src={post.data.heroImage} alt={post.data.title} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
<div class="post-body">
|
<div class="post-main-column">
|
||||||
<Content />
|
{post.data.heroImage && (
|
||||||
|
<div class="hero-image">
|
||||||
|
<img src={post.data.heroImage} alt={post.data.title} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div class="post-body">
|
||||||
|
<Content />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside class="post-sidebar">
|
<aside class="post-sidebar">
|
||||||
|
{post.data.author && (
|
||||||
|
<div class="author-section sidebar-block">
|
||||||
|
<h3>Author</h3>
|
||||||
|
<div class="author-card">
|
||||||
|
<div class="author-name">{post.data.author}</div>
|
||||||
|
{/* Add more author details if needed */}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div class="knowledge-graph-section sidebar-block">
|
||||||
|
<MiniGraph
|
||||||
|
slug={post.slug}
|
||||||
|
title={post.data.title}
|
||||||
|
tags={post.data.tags || []}
|
||||||
|
category={post.data.category || "Uncategorized"}
|
||||||
|
allPosts={allPosts}
|
||||||
|
content={""} {/* Pass empty string for content */}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{post.data.tags && post.data.tags.length > 0 && (
|
{post.data.tags && post.data.tags.length > 0 && (
|
||||||
<div class="tags-section sidebar-block">
|
<div class="tags-section sidebar-block">
|
||||||
<h3>Tags</h3>
|
<h3>Tags</h3>
|
||||||
|
@ -253,11 +277,24 @@ const { Content } = await post.render();
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3fr 1fr;
|
||||||
|
gap: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-main-column {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.hero-image {
|
.hero-image {
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid var(--border-primary);
|
border: 1px solid var(--border-primary);
|
||||||
|
/* Hero image now contained within post-main-column */
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-image img {
|
.hero-image img {
|
||||||
|
@ -266,12 +303,6 @@ const { Content } = await post.render();
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 3fr 1fr;
|
|
||||||
gap: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-body {
|
.post-body {
|
||||||
background: var(--card-bg);
|
background: var(--card-bg);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
@ -298,6 +329,10 @@ const { Content } = await post.render();
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.knowledge-graph-section {
|
||||||
|
padding: 1rem; /* Adjusted padding */
|
||||||
|
}
|
||||||
|
|
||||||
.tags {
|
.tags {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
@ -344,6 +379,21 @@ const { Content } = await post.render();
|
||||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Author Card */
|
||||||
|
.author-card {
|
||||||
|
/* Simplified author card for this example */
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author-name {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
/* Related Posts */
|
/* Related Posts */
|
||||||
.related-posts {
|
.related-posts {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
Loading…
Reference in New Issue