remove dev comments
This commit is contained in:
@@ -3,7 +3,6 @@ import { getCollection } from 'astro:content';
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import { getToolsData } from '../../utils/dataService.js';
|
||||
|
||||
// Prerender these pages at build time
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
@@ -21,33 +20,26 @@ export async function getStaticPaths() {
|
||||
|
||||
const { entry }: { entry: any } = Astro.props;
|
||||
|
||||
// Render the content
|
||||
const { Content } = await entry.render();
|
||||
|
||||
// Load tools data to get the tool details
|
||||
const data = await getToolsData();
|
||||
|
||||
// UPGRADED: Handle optional tool association
|
||||
const primaryTool = entry.data.tool_name
|
||||
? data.tools.find((t: any) => t.name === entry.data.tool_name)
|
||||
: null;
|
||||
|
||||
// UPGRADED: Handle multiple related tools
|
||||
const relatedTools = entry.data.related_tools
|
||||
? entry.data.related_tools.map((toolName: string) =>
|
||||
data.tools.find((t: any) => t.name === toolName)
|
||||
).filter(Boolean)
|
||||
: [];
|
||||
|
||||
// UPGRADED: Use primary tool or first related tool for styling, fallback to generic
|
||||
const displayTool = primaryTool || relatedTools[0];
|
||||
|
||||
// UPGRADED: Don't redirect - show article even without tool association
|
||||
if (!displayTool && !entry.data.tool_name && relatedTools.length === 0) {
|
||||
console.log(`Standalone knowledgebase article: ${entry.slug}`);
|
||||
}
|
||||
|
||||
// Determine styling based on tool type or fallback to generic
|
||||
const isMethod = displayTool?.type === 'method';
|
||||
const isConcept = displayTool?.type === 'concept';
|
||||
const isStandalone = !displayTool;
|
||||
@@ -59,7 +51,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
|
||||
<BaseLayout title={entry.data.title} description={entry.data.description}>
|
||||
<article style="max-width: 900px; margin: 0 auto;">
|
||||
<!-- Header -->
|
||||
<header style="margin-bottom: 2rem; padding: 2rem; background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%); border-radius: 1rem; border: 1px solid var(--color-border);">
|
||||
<div style="display: flex; justify-content: space-between; align-items: start; margin-bottom: 1rem;">
|
||||
<div style="flex: 1;">
|
||||
@@ -73,7 +64,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: column; gap: 0.5rem; align-items: end;">
|
||||
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap;">
|
||||
<!-- UPGRADED: Conditional badges based on tool type or standalone -->
|
||||
{isStandalone ? (
|
||||
<span class="badge" style="background-color: var(--color-accent); color: white;">Artikel</span>
|
||||
) : (
|
||||
@@ -90,9 +80,7 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- UPGRADED: Flexible metadata section -->
|
||||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--color-border);">
|
||||
<!-- Difficulty (always shown if present) -->
|
||||
{entry.data.difficulty && (
|
||||
<div>
|
||||
<strong style="font-size: 0.875rem; color: var(--color-text-secondary);">Schwierigkeit</strong>
|
||||
@@ -100,19 +88,16 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</div>
|
||||
)}
|
||||
|
||||
<!-- Last Updated (always shown) -->
|
||||
<div>
|
||||
<strong style="font-size: 0.875rem; color: var(--color-text-secondary);">Letztes Update</strong>
|
||||
<p style="margin: 0; font-size: 0.9375rem;">{entry.data.last_updated.toLocaleDateString('de-DE')}</p>
|
||||
</div>
|
||||
|
||||
<!-- Author (always shown) -->
|
||||
<div>
|
||||
<strong style="font-size: 0.875rem; color: var(--color-text-secondary);">Autor</strong>
|
||||
<p style="margin: 0; font-size: 0.9375rem;">{entry.data.author}</p>
|
||||
</div>
|
||||
|
||||
<!-- UPGRADED: Show article type -->
|
||||
<div>
|
||||
<strong style="font-size: 0.875rem; color: var(--color-text-secondary);">Typ</strong>
|
||||
<p style="margin: 0; font-size: 0.9375rem;">
|
||||
@@ -123,7 +108,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- UPGRADED: Categories (if present) -->
|
||||
{entry.data.categories && entry.data.categories.length > 0 && (
|
||||
<div style="grid-column: 1 / -1;">
|
||||
<strong style="font-size: 0.875rem; color: var(--color-text-secondary);">Kategorien</strong>
|
||||
@@ -137,7 +121,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav style="margin-bottom: 2rem; position: relative; z-index: 50;">
|
||||
<a href="/knowledgebase" class="btn btn-secondary">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
||||
@@ -147,14 +130,12 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="card" style="padding: 2rem;">
|
||||
<div class="kb-content markdown-content" style="line-height: 1.7;">
|
||||
<Content />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- UPGRADED: Flexible Tool Actions Section -->
|
||||
<div class="card" style="margin-top: 2rem; background-color: var(--color-bg-secondary);">
|
||||
<h3 style="margin: 0 0 1rem 0; color: var(--color-text);">
|
||||
{isStandalone ? 'Verwandte Aktionen' : 'Tool-Aktionen'}
|
||||
@@ -162,7 +143,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
|
||||
<div style="display: flex; gap: 1rem; flex-wrap: wrap;">
|
||||
{isStandalone ? (
|
||||
<!-- UPGRADED: Standalone article actions -->
|
||||
<a href="/knowledgebase" class="btn btn-primary">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
||||
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
||||
@@ -174,7 +154,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
Weitere Artikel
|
||||
</a>
|
||||
) : (
|
||||
<!-- UPGRADED: Tool-specific actions (existing logic) -->
|
||||
<>
|
||||
{isConcept ? (
|
||||
<a href={displayTool.url} target="_blank" rel="noopener noreferrer" class="btn btn-primary" style="background-color: var(--color-concept); border-color: var(--color-concept);">
|
||||
@@ -219,7 +198,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</>
|
||||
)}
|
||||
|
||||
<!-- UPGRADED: Show related tools if present -->
|
||||
{relatedTools.length > 0 && relatedTools.length > (primaryTool ? 1 : 0) && (
|
||||
<div style="margin-left: auto;">
|
||||
<details style="position: relative;">
|
||||
@@ -247,7 +225,6 @@ const hasValidProjectUrl = displayTool && displayTool.projectUrl !== undefined &
|
||||
</div>
|
||||
)}
|
||||
|
||||
<!-- Always show return to main page -->
|
||||
<a href="/" class="btn btn-secondary">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 0.5rem;">
|
||||
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
|
||||
|
||||
Reference in New Issue
Block a user