From 6e02e0219a21340cfd9c0553ac01307a97eafc9f Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Thu, 26 Sep 2024 18:19:30 -0400 Subject: [PATCH] Add open new page when configuring the menu --- app.js | 8 +++++++- views/about.ejs | 2 +- views/blog-post.ejs | 2 +- views/contact.ejs | 2 +- views/index.ejs | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 0ca6db3..69936d8 100644 --- a/app.js +++ b/app.js @@ -36,14 +36,20 @@ function loadMenuItems() { const menuItems = []; const titleRegex = //g; const urlRegex = //g; + const openNewPageRegex = //g; let titleMatch; let urlMatch; + let openNewPageMatch; + // Use a loop to find and process each menu item while ((titleMatch = titleRegex.exec(content)) && (urlMatch = urlRegex.exec(content))) { + openNewPageMatch = openNewPageRegex.exec(content); + menuItems.push({ title: titleMatch[1], - url: urlMatch[1] + url: urlMatch[1], + openNewPage: openNewPageMatch !== null // If openNewPage exists, set it to true }); } diff --git a/views/about.ejs b/views/about.ejs index 9c13469..5634d3f 100644 --- a/views/about.ejs +++ b/views/about.ejs @@ -34,7 +34,7 @@ diff --git a/views/blog-post.ejs b/views/blog-post.ejs index add1fba..b780b7d 100644 --- a/views/blog-post.ejs +++ b/views/blog-post.ejs @@ -32,7 +32,7 @@ diff --git a/views/contact.ejs b/views/contact.ejs index c7d922d..7400058 100644 --- a/views/contact.ejs +++ b/views/contact.ejs @@ -37,7 +37,7 @@ diff --git a/views/index.ejs b/views/index.ejs index 08385c7..e6a74a9 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -20,7 +20,7 @@