mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +00:00
Fix errors and remove internally used tags
This commit is contained in:
parent
4487444510
commit
d9e75704bb
@ -12,7 +12,7 @@ const handler = async (event) => {
|
|||||||
console.log('index made');
|
console.log('index made');
|
||||||
|
|
||||||
let results =
|
let results =
|
||||||
search[0] == "#"
|
search[0] == "#" && search.length > 1
|
||||||
? index.search(`tags:${search.substring(1)}`)
|
? index.search(`tags:${search.substring(1)}`)
|
||||||
: index.search(search);
|
: index.search(search);
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ const handler = async (event) => {
|
|||||||
r.content = truncate(data[r.ref].content, 400);
|
r.content = truncate(data[r.ref].content, 400);
|
||||||
r.date = data[r.ref].date;
|
r.date = data[r.ref].date;
|
||||||
r.url = data[r.ref].url;
|
r.url = data[r.ref].url;
|
||||||
r.tags = data[r.ref].tags;
|
r.tags = data[r.ref].tags.filter(x=>x!="gardenEntry" && x!="note");//Note is automatically added by 11ty. GardenEntry is used internally to mark the home page
|
||||||
|
|
||||||
delete r.ref;
|
delete r.ref;
|
||||||
});
|
});
|
||||||
|
@ -7,5 +7,6 @@ exports.ALL_NOTE_SETTINGS= [
|
|||||||
"dgShowFileTree",
|
"dgShowFileTree",
|
||||||
"dgEnableSearch",
|
"dgEnableSearch",
|
||||||
"dgShowToc",
|
"dgShowToc",
|
||||||
"dgLinkPreview"
|
"dgLinkPreview",
|
||||||
|
"dgShowTags"
|
||||||
];
|
];
|
@ -26,13 +26,13 @@
|
|||||||
x-on:resize.window="isDesktop = (window.innerWidth>=1400) ? true : false;"
|
x-on:resize.window="isDesktop = (window.innerWidth>=1400) ? true : false;"
|
||||||
x-data="{isDesktop: true, showFilesMobile: false}">
|
x-data="{isDesktop: true, showFilesMobile: false}">
|
||||||
|
|
||||||
<div x-show.important="!isDesktop">
|
<div x-show.important="!isDesktop" style="display: none;">
|
||||||
{%include "components/filetreeNavbar.njk"%}
|
{%include "components/filetreeNavbar.njk"%}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div x-show="showFilesMobile && !isDesktop" @click="showFilesMobile = false" style="display:none;" class="fullpage-overlay"></div>
|
<div x-show="showFilesMobile && !isDesktop" @click="showFilesMobile = false" style="display:none;" class="fullpage-overlay"></div>
|
||||||
|
|
||||||
<nav class="filetree-sidebar" x-show.important="isDesktop || showFilesMobile" style="display: block">
|
<nav class="filetree-sidebar" x-show.important="isDesktop || showFilesMobile" style="display: none;">
|
||||||
|
|
||||||
<a href="/" style="text-decoration: none;">
|
<a href="/" style="text-decoration: none;">
|
||||||
<h1 style="text-align:center;">{{meta.siteName}}</h1>
|
<h1 style="text-align:center;">{{meta.siteName}}</h1>
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
window.toggleTagSearch=function(evt) {
|
window.toggleTagSearch=function(evt) {
|
||||||
console.log(evt.textContent);
|
console.log(evt.textContent);
|
||||||
const term = evt.textContent;
|
const term = evt.textContent;
|
||||||
window.document.getElementById('term').value = term;
|
if(term){
|
||||||
window.toggleSearch();
|
window.document.getElementById('term').value = term.trim();
|
||||||
window.search();
|
window.toggleSearch();
|
||||||
|
window.search();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadingSvg = `
|
const loadingSvg = `
|
||||||
@ -201,17 +203,26 @@
|
|||||||
resultsHTML += '<div>';
|
resultsHTML += '<div>';
|
||||||
// we need to add title, url from ref
|
// we need to add title, url from ref
|
||||||
results.forEach(r => {
|
results.forEach(r => {
|
||||||
resultsHTML += `<div class="searchresult">
|
if(r.tags && r.tags.length > 0){
|
||||||
<a class="search-link" href="${r.url}">${r.title}</a>
|
resultsHTML += `<div class="searchresult">
|
||||||
<div onclick="window.location='${r.url}'">
|
<a class="search-link" href="${r.url}">${r.title}</a>
|
||||||
<div class="header-meta">
|
<div onclick="window.location='${r.url}'">
|
||||||
<div class="header-tags">
|
<div class="header-meta">
|
||||||
${r.tags.map(tag=>'<a class="tag" href="JavaScript:Void(0);">#'+tag+'</a>').join("")}
|
<div class="header-tags">
|
||||||
|
${r.tags.map(tag=>'<a class="tag" href="JavaScript:Void(0);">#'+tag+'</a>').join("")}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
${r.content}
|
||||||
</div>
|
</div>
|
||||||
${r.content}
|
</div>`;
|
||||||
</div>
|
} else {
|
||||||
</div>`;
|
resultsHTML += `<div class="searchresult">
|
||||||
|
<a class="search-link" href="${r.url}">${r.title}</a>
|
||||||
|
<div onclick="window.location='${r.url}'">
|
||||||
|
${r.content}
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
resultsHTML += '</div>';
|
resultsHTML += '</div>';
|
||||||
resultsDiv.innerHTML = resultsHTML;
|
resultsDiv.innerHTML = resultsHTML;
|
||||||
|
@ -25,10 +25,10 @@ permalink: "notes/{{ page.fileSlug | slugify }}/"
|
|||||||
<h1>{% if title %}{{ title }}{% else %}{{ page.fileSlug }}{% endif %}</h1>
|
<h1>{% if title %}{{ title }}{% else %}{{ page.fileSlug }}{% endif %}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="header-meta">
|
<div class="header-meta">
|
||||||
{% if tags %}
|
{% if settings.dgShowTags === true and tags %}
|
||||||
<div class="header-tags">
|
<div class="header-tags">
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
{% if tag != 'gardenEntry' %}
|
{% if tag != 'gardenEntry' and tag !='note' %}
|
||||||
<a class="tag" onclick="toggleTagSearch(this)">
|
<a class="tag" onclick="toggleTagSearch(this)">
|
||||||
#{{tag}}
|
#{{tag}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -37,6 +37,13 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
tags: (data) => {
|
||||||
|
const currentnote = data.collections.gardenEntry && data.collections.gardenEntry[0];
|
||||||
|
if (currentnote && currentnote.data) {
|
||||||
|
return currentnote.data.tags;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
content: (data) => {
|
content: (data) => {
|
||||||
const currentnote = data.collections.gardenEntry && data.collections.gardenEntry[0];
|
const currentnote = data.collections.gardenEntry && data.collections.gardenEntry[0];
|
||||||
if (currentnote && currentnote.template && currentnote.template.frontMatter && currentnote.template.frontMatter.content) {
|
if (currentnote && currentnote.template && currentnote.template.frontMatter && currentnote.template.frontMatter.content) {
|
||||||
|
@ -19,6 +19,21 @@
|
|||||||
{% if settings.dgShowInlineTitle === true %}
|
{% if settings.dgShowInlineTitle === true %}
|
||||||
<h1>{{ noteTitle }}</h1>
|
<h1>{{ noteTitle }}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="header-meta">
|
||||||
|
{% if settings.dgShowTags === true and tags %}
|
||||||
|
<div class="header-tags">
|
||||||
|
{% for tag in tags %}
|
||||||
|
{% if tag != 'gardenEntry' and tag !='note' %}
|
||||||
|
<a class="tag" onclick="toggleTagSearch(this)">
|
||||||
|
#{{tag}}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
{%- for garden in collections.gardenEntry -%}
|
{%- for garden in collections.gardenEntry -%}
|
||||||
{{garden.templateContent | link | highlight | safe }}
|
{{garden.templateContent | link | highlight | safe }}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
@ -9,6 +9,6 @@ eleventyExcludeFromCollections: true
|
|||||||
"date":"{{ post.date }}",
|
"date":"{{ post.date }}",
|
||||||
"url":"{{ post.url }}",
|
"url":"{{ post.url }}",
|
||||||
"content": {{ post.templateContent | striptags(true) | link | jsonify | safe }},
|
"content": {{ post.templateContent | striptags(true) | link | jsonify | safe }},
|
||||||
"tags": [{% if post.data.tags %}{% for tag in post.data.tags %}{% if tag != 'gardenEntry' %}"{{tag}}"{% endif %}{% if not loop.last %},{% endif %}{% endfor %}{% endif %}]
|
"tags": [{% if post.data.tags %}{% for tag in post.data.tags %}"{{tag}}"{% if not loop.last %},{% endif %}{% endfor %}{% endif %}]
|
||||||
}{% if not loop.last %},{% endif %}
|
}{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}]
|
{% endfor %}]
|
||||||
|
@ -230,7 +230,7 @@ ul.task-list {
|
|||||||
transform: none;
|
transform: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
max-width: 800px;
|
max-width: 700px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border-top: 2px solid var(--background-secondary);
|
border-top: 2px solid var(--background-secondary);
|
||||||
@ -522,6 +522,17 @@ div[class*="callout-"] {
|
|||||||
white-space: normal !important;
|
white-space: normal !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 10px;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-meta {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
div.language-ad-note,
|
div.language-ad-note,
|
||||||
div.callout-note {
|
div.callout-note {
|
||||||
.admonition-title::before {
|
.admonition-title::before {
|
||||||
|
@ -92,14 +92,3 @@ p>code {
|
|||||||
color: #c7254e;
|
color: #c7254e;
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-tags {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
margin-top: 10px;
|
|
||||||
gap: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-meta {
|
|
||||||
margin-bottom: 1.8em;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user