diff --git a/content/static/tinysearch_json.md b/content/static/tinysearch_json.md deleted file mode 100644 index c91a639f..00000000 --- a/content/static/tinysearch_json.md +++ /dev/null @@ -1,5 +0,0 @@ -+++ -path = "data_tinysearch" -template = "tinysearch_json.html" -draft = true -+++ diff --git a/package_abridge.js b/package_abridge.js index 1edc2437..9ddfdce9 100644 --- a/package_abridge.js +++ b/package_abridge.js @@ -84,23 +84,7 @@ async function abridge() { base_url = base_url.slice(0, -1); } - if (search_library === 'elasticlunr') { - if (fs.existsSync('content/static/tinysearch_json.md')) { - replaceInFileSync({files: 'content/static/tinysearch_json.md', from: /draft.*=.*/g, to: "draft = true"}); - } - } else if (search_library === 'tinysearch') { - if (!fs.existsSync('content/static/tinysearch_json.md')) {// 'content/static/tinysearch_json.md' file is missing, copy from abridge theme. - fs.copyFileSync(bpath+'content/static/tinysearch_json.md', 'content/static/tinysearch_json.md',fs.constants.COPYFILE_EXCL); - } - if (fs.existsSync('content/static/tinysearch_json.md')) { - replaceInFileSync({files: 'content/static/tinysearch_json.md', from: /draft.*=.*/g, to: "draft = false"}); - } - // zola build && mkdir -p tmp && tinysearch --optimize --path tmp public/data_tinysearch/index.html && rsync -avz tmp/*.wasm static/ && rm -rf tmp - } else if (search_library === 'pagefind') { - if (fs.existsSync('content/static/tinysearch_json.md')) { - replaceInFileSync({files: 'content/static/tinysearch_json.md', from: /draft.*=.*/g, to: "draft = true"}); - } - + if (search_library === 'pagefind') { // Run the pagefind script to generate the index files. // Has to happen at start otherwise, it happens too late asyncronously. const createIndex = require('./static/js/pagefind.index.cjs'); // run the pagefind index.js script diff --git a/templates/macros/create_tinysearch_json.html b/templates/macros/create_tinysearch_json.html deleted file mode 100644 index fcc1f5a5..00000000 --- a/templates/macros/create_tinysearch_json.html +++ /dev/null @@ -1,27 +0,0 @@ -{%- macro from_section(section) -%} -{%- set section = get_section(path=section) -%} -{%- for post in section.pages -%} -{%- if not post.draft -%} -{%- set found = true -%} -{ -"title": {{ post.title | striptags | json_encode | safe }}, -"url": {{ post.permalink | json_encode | safe }}, -"meta": {% if post.summary %} - {{- post.summary | striptags | truncate(length=150) | json_encode | safe }} - {%- elif post.description %} - {{- post.description | striptags | truncate(length=150) | json_encode | safe }} - {%- elif post.content %} - {{- post.content | striptags | truncate(length=150) | json_encode | safe }} - {%- endif %}, -"body": {{ post.content | striptags | json_encode | safe }} -} -{%- if not loop.last -%},{%- endif %} -{%- endif -%} -{%- endfor -%} -{%- if found and section.subsections -%} -, -{%- for subsection in section.subsections -%} -{{ self::from_section(section=subsection) }} -{%- endfor -%} -{%- endif -%} -{%- endmacro from_section -%} diff --git a/templates/tinysearch_json.html b/templates/tinysearch_json.html deleted file mode 100644 index 37f83a18..00000000 --- a/templates/tinysearch_json.html +++ /dev/null @@ -1,5 +0,0 @@ -{%- import "macros/create_tinysearch_json.html" as create_tinysearch_json -%} - -{%- if config.extra.search_library %}{%- if config.extra.search_library == "tinysearch" %} -[{{ create_tinysearch_json::from_section(section="_index.md", config=config) }}] -{%- endif %}{%- endif %} \ No newline at end of file