mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-08 05:35:20 +00:00
Use dghomelink as toggle for navbar
This commit is contained in:
parent
eee9e9aa5f
commit
9f477fb3ab
@ -1,4 +1,5 @@
|
|||||||
<nav class="navbar">
|
{%if settings.dgHomeLink === true%}
|
||||||
|
<nav class="navbar">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<a href="/" style="text-decoration: none;">
|
<a href="/" style="text-decoration: none;">
|
||||||
<h1>{{meta.siteName}}</h1>
|
<h1>{{meta.siteName}}</h1>
|
||||||
@ -7,4 +8,11 @@
|
|||||||
{% if settings.dgEnableSearch === true%}
|
{% if settings.dgEnableSearch === true%}
|
||||||
{% include "components/searchButton.njk" %}
|
{% include "components/searchButton.njk" %}
|
||||||
{%endif%}
|
{%endif%}
|
||||||
</nav>
|
</nav>
|
||||||
|
{%else%}
|
||||||
|
<div class="empty-navbar" >
|
||||||
|
{% if settings.dgEnableSearch === true%}
|
||||||
|
{% include "components/searchButton.njk" %}
|
||||||
|
{%endif%}
|
||||||
|
</div>
|
||||||
|
{%endif%}
|
@ -1,20 +1,23 @@
|
|||||||
|
require("dotenv").config()
|
||||||
const lunrjs = require('lunr');
|
const lunrjs = require('lunr');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
function createIndex(posts) {
|
function createIndex(posts) {
|
||||||
return lunrjs(function() {
|
return lunrjs(function () {
|
||||||
this.ref('id');
|
this.ref('id');
|
||||||
this.field('title');
|
this.field('title');
|
||||||
this.field('content');
|
this.field('content');
|
||||||
this.field('date');
|
this.field('date');
|
||||||
|
|
||||||
posts.forEach((p,idx) => {
|
posts.forEach((p, idx) => {
|
||||||
p.id = idx;
|
p.id = idx;
|
||||||
this.add(p);
|
this.add(p);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = require('../../netlify/functions/search/data.json');
|
if (process.env.dgEnableSearch) {
|
||||||
const index = createIndex(data);
|
const data = require('../../netlify/functions/search/data.json');
|
||||||
require('fs').writeFileSync(path.join(__dirname, '../../netlify/functions/search/index.json'), JSON.stringify(index));
|
const index = createIndex(data);
|
||||||
|
require('fs').writeFileSync(path.join(__dirname, '../../netlify/functions/search/index.json'), JSON.stringify(index));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user