diff --git a/img/logo.png b/img/logo.png
new file mode 100644
index 0000000..67f8b9a
Binary files /dev/null and b/img/logo.png differ
diff --git a/index.html b/index.html
index 3da6cbb..68ae32c 100644
--- a/index.html
+++ b/index.html
@@ -27,7 +27,7 @@
Failed to load documentation index.';
}
@@ -257,17 +244,13 @@ async function loadDocument(path) {
let rawContent = await response.text();
const { metadata, content } = extractMetadata(rawContent);
- // Get the title from index.json
const indexResponse = await fetch('index.json');
const indexData = await indexResponse.json();
const docEntry = findDocumentByPath(indexData.documents, path);
- // Use title priority: frontmatter > json > filename
const titleContent = metadata.title || (docEntry && docEntry.title) || path.split('/').pop().replace('.md', '');
- // Process Obsidian internal links before adding the title
let processedContent = content.replace(/\[\[(.*?)\]\]/g, (match, linkText) => {
- // Skip image/media processing
if (linkText.match(/\.(png|jpg|jpeg|gif|mp4|webm)$/i)) {
return match;
}
@@ -281,7 +264,6 @@ async function loadDocument(path) {
processedContent = `# ${titleContent}\n\n${processedContent}`;
- // Process images/media after internal links
const finalContent = processedContent.replace(/!\[\[(.*?)\]\]/g, (match, filename) => {
const mediaPath = `${basePath}/images/${filename}`;
@@ -295,33 +277,6 @@ async function loadDocument(path) {
return `\n\n\n`;
});
- 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 (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);
- }
-
document.title = `Litruv / ${titleContent}`;
document.querySelector('.title-text .page-title').textContent = titleContent;
@@ -342,11 +297,9 @@ async function loadDocument(path) {
const link = document.createElement('a');
link.href = `${window.location.pathname}${window.location.search}#${heading.id}`;
link.textContent = heading.textContent;
- // Add non-zero indentation
link.style.paddingLeft = (heading.tagName[1] * 15) + 'px';
headingLinks.set(heading, link);
- // Add extra space to avoid scrolling beneath the header
heading.style.scrollMarginTop = 'var(--title-bar-height)';
link.onclick = (e) => {
@@ -365,7 +318,6 @@ async function loadDocument(path) {
documentOutline.appendChild(link);
});
- // Replace the existing observer with this refined version
const observer = new IntersectionObserver((entries) => {
const visibleHeadings = entries
.filter(entry => entry.isIntersecting)
@@ -383,11 +335,9 @@ async function loadDocument(path) {
headings.forEach(heading => observer.observe(heading));
- // Clean up observer when loading new document
return () => observer.disconnect();
} catch (error) {
- console.error('Error loading document:', error);
document.getElementById('document-content').innerHTML =
'Error loading document. Please try again.
';
}
@@ -429,16 +379,13 @@ function setupMobileMenu() {
}
window.addEventListener('load', () => {
- console.log('Window loaded, initializing...');
setupMobileMenu();
loadIndex().catch(error => {
- console.error('Failed to initialize:', error);
document.getElementById('document-content').innerHTML =
'Failed to load documentation. Please try refreshing the page.
';
});
});
-// Globally intercept clicks on internal links
document.addEventListener('click', async (e) => {
const target = e.target.closest('a[data-internal="true"]');
if (target) {
@@ -448,8 +395,6 @@ document.addEventListener('click', async (e) => {
const matchingDoc = findDocumentBySlug(indexData.documents, slug);
if (matchingDoc) {
await loadDocument(matchingDoc.path);
- // Scroll to the top after loading
- window.scrollTo({ top: 0, behavior: 'smooth' });
history.pushState(null, '', target.href);
}
}
diff --git a/styles.css b/styles.css
index 7246690..8030825 100644
--- a/styles.css
+++ b/styles.css
@@ -489,11 +489,14 @@ social-links a:hover {
gap: 0.5rem;
}
-.title-text .brand {
- color: var(--ifm-color-primary);
- font-weight: 800;
- letter-spacing: -0.01em;
- font-size: 1.2rem;
+.brand-logo {
+ height: 24px;
+ width: auto;
+ display: block;
+}
+
+.title-text .divider {
+ padding: 0 0 0 10px;
}
.title-text .divider,