|
@@ -139,9 +139,10 @@
|
|
|
// 網址有參數
|
|
|
if (tagsVal !== null) {
|
|
|
contentsData.map(item => {
|
|
|
- if (item.blog_tag) {
|
|
|
- if (item.blog_tag.includes(tagsVal)) {
|
|
|
- matchContent += `
|
|
|
+ if (item.draft !== "true") {
|
|
|
+ if (item.blog_tag) {
|
|
|
+ if (item.blog_tag.includes(tagsVal)) {
|
|
|
+ matchContent += `
|
|
|
<div class="article-item">
|
|
|
<a href="${item.url}?tags=${tagsVal}">
|
|
|
<img src="${item.image}" alt="">
|
|
@@ -156,71 +157,77 @@
|
|
|
</a>
|
|
|
</div>
|
|
|
</div>`
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
} else if (url.pathname === '/blog/') {
|
|
|
contentsData.map(item => {
|
|
|
- // 排除根目錄
|
|
|
- if (item.url !== "/blog") {
|
|
|
- matchContent += `
|
|
|
- <div class="article-item">
|
|
|
- <a href="${item.url}">
|
|
|
- <img src="${item.image}" alt="">
|
|
|
- </a>
|
|
|
- <div class="d-flex flex-column">
|
|
|
+ if (item.draft !== "true") {
|
|
|
+ // 排除根目錄
|
|
|
+ if (item.url !== "/blog") {
|
|
|
+ matchContent += `
|
|
|
+ <div class="article-item">
|
|
|
<a href="${item.url}">
|
|
|
- <h4>${item.title}</h4>
|
|
|
- </a>
|
|
|
- <p class="mt-auto my-2 fw-bold">${item.date.substr(0, 10)}</p>
|
|
|
- <a href="${item.url}" class="description">
|
|
|
- <p style="letter-spacing: 1px;">${item.description}</p>
|
|
|
+ <img src="${item.image}" alt="">
|
|
|
</a>
|
|
|
- </div>
|
|
|
- </div>`
|
|
|
+ <div class="d-flex flex-column">
|
|
|
+ <a href="${item.url}">
|
|
|
+ <h4>${item.title}</h4>
|
|
|
+ </a>
|
|
|
+ <p class="mt-auto my-2 fw-bold">${item.date.substr(0, 10)}</p>
|
|
|
+ <a href="${item.url}" class="description">
|
|
|
+ <p style="letter-spacing: 1px;">${item.description}</p>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
} else {
|
|
|
// 網址沒有參數
|
|
|
contentsData.map(item => {
|
|
|
- if (category !== null) {
|
|
|
- if (item.categories) {
|
|
|
- if (item.categories.includes(category)) {
|
|
|
- matchContent += `
|
|
|
- <div class="article-item">
|
|
|
- <a href="${item.url}">
|
|
|
- <img src="${item.image}" alt="">
|
|
|
- </a>
|
|
|
- <div class="d-flex flex-column">
|
|
|
- <a href="${item.url}">
|
|
|
- <h4>${item.title}</h4>
|
|
|
- </a>
|
|
|
- <p class="mt-auto my-2 fw-bold">${item.date.substr(0, 10)}</p>
|
|
|
- <a href="${item.url}" class="description">
|
|
|
- <p style="letter-spacing: 1px;">${item.description}</p>
|
|
|
- </a>
|
|
|
- </div>
|
|
|
- </div>`
|
|
|
+ if (item.draft !== "true") {
|
|
|
+ if (category !== null) {
|
|
|
+ if (item.categories) {
|
|
|
+ if (item.categories.includes(category)) {
|
|
|
+ matchContent += `
|
|
|
+ <div class="article-item">
|
|
|
+ <a href="${item.url}">
|
|
|
+ <img src="${item.image}" alt="">
|
|
|
+ </a>
|
|
|
+ <div class="d-flex flex-column">
|
|
|
+ <a href="${item.url}">
|
|
|
+ <h4>${item.title}</h4>
|
|
|
+ </a>
|
|
|
+ <p class="mt-auto my-2 fw-bold">${item.date.substr(0, 10)}</p>
|
|
|
+ <a href="${item.url}" class="description">
|
|
|
+ <p style="letter-spacing: 1px;">${item.description}</p>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- matchContent += `
|
|
|
- <div class="article-item">
|
|
|
- <a href="${item.url}">
|
|
|
- <img src="${item.image}" alt="">
|
|
|
- </a>
|
|
|
- <div class="d-flex flex-column">
|
|
|
+ } else {
|
|
|
+ matchContent += `
|
|
|
+ <div class="article-item">
|
|
|
<a href="${item.url}">
|
|
|
- <h4>${item.title}</h4>
|
|
|
- </a>
|
|
|
- <p class="mt-auto my-2 fw-bold">${item.date.substr(0, 10)}</p>
|
|
|
- <a href="${item.url}" class="description">
|
|
|
- <p style="letter-spacing: 1px;">${item.description}</p>
|
|
|
+ <img src="${item.image}" alt="">
|
|
|
</a>
|
|
|
- </div>
|
|
|
- </div>`
|
|
|
+ <div class="d-flex flex-column">
|
|
|
+ <a href="${item.url}">
|
|
|
+ <h4>${item.title}</h4>
|
|
|
+ </a>
|
|
|
+ <p class="mt-auto my-2 fw-bold">${item.date.substr(0, 10)}</p>
|
|
|
+ <a href="${item.url}" class="description">
|
|
|
+ <p style="letter-spacing: 1px;">${item.description}</p>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -250,9 +257,10 @@
|
|
|
// if (item.categories) {
|
|
|
// if (item.categories.includes(category)) {
|
|
|
// 搜尋所有分類文章
|
|
|
- if (item.url !== '/blog') {
|
|
|
- if (item.title.includes(inputVal) || item.description.includes(inputVal) || item.content.includes(inputVal)) {
|
|
|
- matchContent += `
|
|
|
+ if (item.draft !== "true") {
|
|
|
+ if (item.url !== '/blog') {
|
|
|
+ if (item.title.includes(inputVal) || item.description.includes(inputVal) || item.content.includes(inputVal)) {
|
|
|
+ matchContent += `
|
|
|
<div class="article-item">
|
|
|
<a href="${item.url}">
|
|
|
<img src="${item.image}" alt="">
|
|
@@ -267,12 +275,12 @@
|
|
|
</a>
|
|
|
</div>
|
|
|
</div>`
|
|
|
- } else {
|
|
|
- falseItem.push(item);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ falseItem.push(item);
|
|
|
+ }
|
|
|
|
|
|
- if (falseItem.length === contentsData.length - 1) {
|
|
|
- matchContent = `
|
|
|
+ if (falseItem.length === contentsData.length - 1) {
|
|
|
+ matchContent = `
|
|
|
<div class="alert d-flex align-items-center" role="alert" style="max-width: 300px;margin: 0 auto 25px;justify-content: center;">
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-exclamation-triangle-fill flex-shrink-0 me-2" style="color: #808e4c;" viewBox="0 0 16 16" role="img" aria-label="Warning:">
|
|
|
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
|
|
@@ -282,6 +290,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
`;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// }
|