mirror of
https://github.com/litruv/Docs-Viewer.git
synced 2026-07-24 02:36:07 +10:00
Enhance documentation with dynamic meta tags and update Blueprint description
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
---
|
||||
title: Blueprint Depth Trace
|
||||
description: A Blueprint Function Library for depth-based line traces in Unreal Engine, providing realistic penetration and bullet holes
|
||||
image: TraceExample.png
|
||||
---
|
||||
This is a `Blueprint Function Library` with a few functions that are callable in `AActors` to do depth trace results, for use in things like projectiles and tools.
|
||||
|
||||
|
||||
12
index.html
12
index.html
@@ -4,6 +4,18 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Documentation Viewer</title>
|
||||
|
||||
<!-- Dynamic Meta Tags -->
|
||||
<meta name="description" content="Documentation for Litruv's tools and projects">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:site_name" content="Litruv Documentation">
|
||||
<meta property="og:title" content="Documentation">
|
||||
<meta property="og:description" content="Documentation for Litruv's tools and projects">
|
||||
<meta property="og:url" content="">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:title" content="Documentation">
|
||||
<meta name="twitter:description" content="Documentation for Litruv's tools and projects">
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism-tomorrow.min.css">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css">
|
||||
|
||||
29
index.js
29
index.js
@@ -179,6 +179,35 @@ async function loadDocument(path) {
|
||||
return `\n\n\n`;
|
||||
});
|
||||
|
||||
// Update meta tags
|
||||
const description = metadata.description || `Documentation for ${titleContent}`;
|
||||
const url = `${window.location.origin}${window.location.pathname}${window.location.search}`;
|
||||
|
||||
document.title = `Litruv / ${titleContent}`;
|
||||
document.querySelector('meta[name="description"]').setAttribute('content', description);
|
||||
document.querySelector('meta[property="og:title"]').setAttribute('content', titleContent);
|
||||
document.querySelector('meta[property="og:description"]').setAttribute('content', description);
|
||||
document.querySelector('meta[property="og:url"]').setAttribute('content', url);
|
||||
document.querySelector('meta[name="twitter:title"]').setAttribute('content', titleContent);
|
||||
document.querySelector('meta[name="twitter:description"]').setAttribute('content', description);
|
||||
|
||||
// If there's a cover image in metadata
|
||||
if (metadata.image) {
|
||||
const imageUrl = `${window.location.origin}${window.location.pathname}${basePath}/images/${metadata.image}`;
|
||||
document.querySelector('meta[property="og:image"]')?.remove();
|
||||
document.querySelector('meta[name="twitter:image"]')?.remove();
|
||||
|
||||
const ogImage = document.createElement('meta');
|
||||
ogImage.setAttribute('property', 'og:image');
|
||||
ogImage.setAttribute('content', imageUrl);
|
||||
document.head.appendChild(ogImage);
|
||||
|
||||
const twitterImage = document.createElement('meta');
|
||||
twitterImage.setAttribute('name', 'twitter:image');
|
||||
twitterImage.setAttribute('content', imageUrl);
|
||||
document.head.appendChild(twitterImage);
|
||||
}
|
||||
|
||||
// Update page and title bar while preserving menu button and brand
|
||||
document.title = `Litruv / ${titleContent}`;
|
||||
document.querySelector('.title-text .page-title').textContent = titleContent;
|
||||
|
||||
Reference in New Issue
Block a user