feat: Suggest HTML importer on URL importer failure (#6685)

This commit is contained in:
Michael Genson
2025-12-09 11:05:34 -06:00
committed by GitHub
parent 53ee64828b
commit e0d8104643
2 changed files with 27 additions and 8 deletions

View File

@@ -636,6 +636,8 @@
"scrape-recipe-suggest-bulk-importer": "Try out the bulk importer",
"scrape-recipe-have-raw-html-or-json-data": "Have raw HTML or JSON data?",
"scrape-recipe-you-can-import-from-raw-data-directly": "You can import from raw data directly",
"scrape-recipe-website-being-blocked": "Website being blocked?",
"scrape-recipe-try-importing-raw-html-instead": "Try importing the raw HTML instead.",
"import-original-keywords-as-tags": "Import original keywords as tags",
"stay-in-edit-mode": "Stay in Edit mode",
"parse-recipe-ingredients-after-import": "Parse recipe ingredients after import",

View File

@@ -12,10 +12,10 @@
<p>{{ $t('recipe.scrape-recipe-description') }}</p>
<p>
{{ $t('recipe.scrape-recipe-have-a-lot-of-recipes') }}
<a :href="bulkImporterTarget">{{ $t('recipe.scrape-recipe-suggest-bulk-importer') }}</a>.
<router-link :to="bulkImporterTarget">{{ $t('recipe.scrape-recipe-suggest-bulk-importer') }}</router-link>.
<br>
{{ $t('recipe.scrape-recipe-have-raw-html-or-json-data') }}
<a :href="htmlOrJsonImporterTarget">{{ $t('recipe.scrape-recipe-you-can-import-from-raw-data-directly') }}</a>.
<router-link :to="htmlOrJsonImporterTarget">{{ $t('recipe.scrape-recipe-you-can-import-from-raw-data-directly') }}</router-link>.
</p>
<v-text-field
v-model="recipeUrl"
@@ -81,10 +81,17 @@
</v-card-title>
<v-divider class="my-3 mx-2" />
<p>
{{ $t("new-recipe.error-details") }}
</p>
<div class="d-flex row justify-space-around my-3 force-white">
<div class="force-url-white">
<p>
{{ $t("recipe.scrape-recipe-website-being-blocked") }}
<router-link :to="htmlOrJsonImporterTarget">{{ $t("recipe.scrape-recipe-try-importing-raw-html-instead") }}</router-link>
</p>
<br>
<p>
{{ $t("new-recipe.error-details") }}
</p>
</div>
<div class="d-flex row justify-space-around my-3 force-url-white">
<a
class="dark"
href="https://developers.google.com/search/docs/data-types/recipe"
@@ -202,6 +209,16 @@ export default defineNuxtComponent({
const domUrlForm = ref<VForm | null>(null);
// Remove import URL from query params when leaving the page
const isLeaving = ref(false);
onBeforeRouteLeave((to) => {
if (isLeaving.value) {
return;
}
isLeaving.value = true;
router.replace({ query: undefined }).then(() => router.push(to));
});
async function createByUrl(url: string | null, importKeywordsAsTags: boolean) {
if (url === null) {
return;
@@ -232,8 +249,8 @@ export default defineNuxtComponent({
});
</script>
<style>
.force-white > a {
<style scoped>
.force-url-white a {
color: white !important;
}
</style>