From b096529704f5181e9ad0c2515348ea52478a7cdf Mon Sep 17 00:00:00 2001 From: Nicholas Jitkoff Date: Thu, 22 Dec 2022 20:07:22 -0800 Subject: [PATCH] Ignore empty recipes --- docs/index.js | 2 +- docs/render/parse.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/index.js b/docs/index.js index a595bc1..1b4cdf4 100644 --- a/docs/index.js +++ b/docs/index.js @@ -204,7 +204,7 @@ el("div", {}, error), el("form", {method: "dialog"}, - el("button", {onclick:history.back.bind(history)}, "Learn More"), + el("button", {onclick:() => location.href = "https://parse.bitty.site"}, "Learn More"), el("button", {onclick:history.back.bind(history)}, "Go Back"))); document.body.appendChild(dialog) dialog.showModal(); diff --git a/docs/render/parse.js b/docs/render/parse.js index 2792041..a0839c7 100644 --- a/docs/render/parse.js +++ b/docs/render/parse.js @@ -126,6 +126,8 @@ let scrapeRecipe = async document => { let recipe = findLDJsonRecipe(doc) || findMicrodataRecipe(doc) || await scrapeRecipe(doc); + +if (!recipe.recipeInstructions) recipe = undefined; if (recipe) { let url = doc.evaluate('//meta[@property="og:url"]/@content', doc, null, XPathResult.STRING_TYPE)?.stringValue;