Spaces:
Running
Running
Download article.html from Tako12/almosrdone2: direct link, hf CLI and curl.
- Browser
- Download file 10.5 kB
-
https://huggingface.co/spaces/Tako12/almosrdone2/resolve/main/article.html
- Command line
-
hf download hf://spaces/Tako12/almosrdone2/article.html
-
curl -L -o article.html https://huggingface.co/spaces/Tako12/almosrdone2/resolve/main/article.html
10.5 kB
| <html lang="en" class="light"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Article | Moodscape</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> | |
| <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet"> | |
| <style> | |
| body { | |
| font-family: 'Inter', sans-serif; | |
| transition: background-color 0.3s ease, color 0.3s ease; | |
| } | |
| .playfair { | |
| font-family: 'Playfair Display', serif; | |
| } | |
| .light { | |
| background-color: ivory; | |
| color: #333333; | |
| } | |
| .dark { | |
| background-color: #333333; | |
| color: #FFFFF0; | |
| } | |
| .markdown-content img { | |
| max-width: 100%; | |
| height: auto; | |
| border-radius: 0.5rem; | |
| margin: 1rem 0; | |
| } | |
| .markdown-content h2 { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 1.75rem; | |
| font-weight: 700; | |
| margin: 1.5rem 0 1rem; | |
| } | |
| .markdown-content p { | |
| margin-bottom: 1rem; | |
| line-height: 1.6; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-ivory text-gray-800 dark:bg-gray-900 dark:text-gray-100 min-h-screen"> | |
| <!-- Header --> | |
| <header class="sticky top-0 z-50 bg-white/80 backdrop-blur-sm dark:bg-gray-800/80 shadow-sm"> | |
| <div class="container mx-auto px-4 py-4 flex items-center justify-between"> | |
| <div class="flex items-center space-x-8"> | |
| <a href="index.html" class="flex items-center text-2xl font-bold playfair text-gray-800 dark:text-white"> | |
| <img src="http://static.photos/minimal/32x32/42" alt="Logo" class="w-8 h-8 mr-2 rounded-full border-2 border-indigo-400"> | |
| Moodescape | |
| </a> | |
| <nav class="hidden md:flex space-x-6"> | |
| <a href="index.html?category=books" class="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white transition">Books</a> | |
| <a href="index.html?category=films" class="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white transition">Films/Series</a> | |
| <a href="index.html?category=anime" class="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white transition">Anime</a> | |
| <a href="index.html?category=games" class="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white transition">Games</a> | |
| </nav> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <a href="/admin/" class="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white transition">Admin</a> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Article Content --> | |
| <main class="container mx-auto px-4 py-16 max-w-4xl"> | |
| <div id="article-content" class="animate-fade-in"> | |
| <!-- Loading spinner --> | |
| <div id="loading-spinner" class="flex justify-center items-center py-16"> | |
| <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-indigo-500"></div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Also Read Section --> | |
| <section class="bg-gray-50 dark:bg-gray-800 py-16"> | |
| <div class="container mx-auto px-4"> | |
| <h2 class="playfair text-3xl font-bold mb-8 text-center">Also Read</h2> | |
| <div id="related-articles" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | |
| <!-- Related articles will be loaded here --> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Footer --> | |
| <footer class="bg-gray-100 dark:bg-gray-800 py-12"> | |
| <div class="container mx-auto px-4"> | |
| <div class="text-center"> | |
| <p class="text-gray-600 dark:text-gray-300">© 2025 Moodscape. All rights reserved.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| // Get slug from URL | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const slug = urlParams.get('slug'); | |
| // Load article data | |
| async function loadArticle() { | |
| if (!slug) { | |
| window.location.href = 'index.html'; | |
| return; | |
| } | |
| try { | |
| // Show loading spinner | |
| document.getElementById('loading-spinner').classList.remove('hidden'); | |
| // Load the article | |
| const response = await fetch(`/articles/${slug}.json`); | |
| if (!response.ok) throw new Error('Article not found'); | |
| const article = await response.json(); | |
| // Render the article | |
| renderArticle(article); | |
| // Load related articles | |
| await loadRelatedArticles(article.category, slug); | |
| } catch (error) { | |
| console.error('Error loading article:', error); | |
| window.location.href = 'index.html'; | |
| } finally { | |
| // Hide loading spinner | |
| document.getElementById('loading-spinner').classList.add('hidden'); | |
| } | |
| } | |
| async function loadRelatedArticles(category, currentSlug) { | |
| try { | |
| // Get all articles in the same category | |
| const response = await fetch('/articles.json'); | |
| const allArticles = await response.json(); | |
| // Filter to same category, exclude current article, limit to 3 | |
| const related = allArticles | |
| .filter(a => a.category === category && a.slug !== currentSlug) | |
| .slice(0, 3); | |
| renderRelatedArticles(related); | |
| } catch (error) { | |
| console.error('Error loading related articles:', error); | |
| } | |
| } | |
| function renderArticle(article) { | |
| const container = document.getElementById('article-content'); | |
| const categoryColors = { | |
| books: 'indigo', | |
| films: 'purple', | |
| anime: 'rose', | |
| games: 'emerald' | |
| }; | |
| // Format date | |
| const articleDate = new Date(article.date); | |
| const formattedDate = articleDate.toLocaleDateString('en-US', { | |
| year: 'numeric', | |
| month: 'long', | |
| day: 'numeric' | |
| }); | |
| container.innerHTML = ` | |
| <article> | |
| <span class="text-sm text-${categoryColors[article.category]}-600 dark:text-${categoryColors[article.category]}-300 font-medium"> | |
| ${article.category.charAt(0).toUpperCase() + article.category.slice(1)} | |
| </span> | |
| <h1 class="playfair text-4xl font-bold mt-2 mb-4">${article.title}</h1> | |
| <div class="flex items-center mb-8"> | |
| <span class="text-gray-600 dark:text-gray-300">By ${article.author}</span> | |
| <span class="mx-2 text-gray-400">•</span> | |
| <span class="text-gray-600 dark:text-gray-300">${formattedDate}</span> | |
| </div> | |
| <img src="${article.image}" alt="${article.title}" class="w-full h-auto rounded-lg mb-8"> | |
| <div class="markdown-content prose dark:prose-invert max-w-none">${marked.parse(article.content)}</div> | |
| </article> | |
| `; | |
| } | |
| function renderRelatedArticles(articles) { | |
| const container = document.getElementById('related-articles'); | |
| if (!articles.length) { | |
| container.innerHTML = '<p class="text-gray-600 dark:text-gray-300 col-span-3 text-center">No related articles found</p>'; | |
| return; | |
| } | |
| container.innerHTML = articles.map(article => ` | |
| <a href="article.html?slug=${article.slug}" class="card-hover bg-white dark:bg-gray-700 rounded-lg shadow-md overflow-hidden transition hover:shadow-lg"> | |
| <img src="${article.image}" alt="${article.title}" class="w-full h-48 object-cover"> | |
| <div class="p-4"> | |
| <h3 class="playfair text-xl font-bold mb-2">${article.title}</h3> | |
| <p class="text-gray-600 dark:text-gray-300 text-sm line-clamp-2">${article.description}</p> | |
| </div> | |
| </a> | |
| `).join(''); | |
| } | |
| // Initialize | |
| document.addEventListener('DOMContentLoaded', () => { | |
| loadArticle(); | |
| feather.replace(); | |
| // Add style for markdown content | |
| const style = document.createElement('style'); | |
| style.textContent = ` | |
| .markdown-content h2 { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 1.75rem; | |
| font-weight: 700; | |
| margin: 1.5rem 0 1rem; | |
| } | |
| .markdown-content h3 { | |
| font-family: 'Playfair Display', serif; | |
| font-size: 1.5rem; | |
| font-weight: 600; | |
| margin: 1.25rem 0 0.75rem; | |
| } | |
| .markdown-content p { | |
| margin-bottom: 1rem; | |
| line-height: 1.6; | |
| } | |
| .markdown-content ul, .markdown-content ol { | |
| margin-bottom: 1rem; | |
| padding-left: 1.5rem; | |
| } | |
| .markdown-content li { | |
| margin-bottom: 0.5rem; | |
| } | |
| .markdown-content blockquote { | |
| border-left: 4px solid #818cf8; | |
| padding-left: 1rem; | |
| margin: 1rem 0; | |
| font-style: italic; | |
| color: #4b5563; | |
| } | |
| .dark .markdown-content blockquote { | |
| color: #d1d5db; | |
| } | |
| `; | |
| document.head.appendChild(style); | |
| }); | |
| </script> | |
| </body> | |
| </html> |