Spaces:
Running
Running
Download script.js from Tako12/almosrdone2: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/Tako12/almosrdone2/resolve/main/script.js
- Command line
-
hf download hf://spaces/Tako12/almosrdone2/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Tako12/almosrdone2/resolve/main/script.js
1.99 kB
| // Load content from JSON and update meta tags | |
| document.addEventListener('DOMContentLoaded', function() { | |
| fetch('content.json') | |
| .then(response => response.json()) | |
| .then(data => { | |
| if (window.location.pathname.includes('article')) { | |
| // Get article slug from URL | |
| const slug = window.location.pathname.split('/').pop().replace('.html', ''); | |
| const article = data.articles.find(a => a.slug === slug); | |
| if (article) { | |
| // Update meta tags for article page | |
| document.title = `${article.title} | Moodscape`; | |
| document.querySelector('meta[name="description"]').content = article.description; | |
| document.querySelector('meta[property="og:title"]').content = `${article.title} | Moodscape`; | |
| document.querySelector('meta[property="og:description"]').content = article.description; | |
| document.querySelector('meta[property="og:image"]').content = article.image; | |
| document.querySelector('meta[property="og:url"]').content = window.location.href; | |
| } | |
| } else { | |
| // Update meta tags for homepage | |
| document.title = "Moodscape | Discover Your Next Vibe"; | |
| document.querySelector('meta[name="description"]').content = "Explore articles and content that resonate with the stories you love."; | |
| document.querySelector('meta[property="og:title"]').content = "Moodscape | Discover Your Next Vibe"; | |
| document.querySelector('meta[property="og:description"]').content = "Explore articles and content that resonate with the stories you love."; | |
| document.querySelector('meta[property="og:url"]').content = window.location.href; | |
| } | |
| }) | |
| .catch(error => console.error('Error loading content:', error)); | |
| }); | |