|
1 | 1 | function BlogSection() { |
2 | 2 | let Posts = "" |
3 | | - window.Blogs.forEach(Post => { |
4 | | - if(!Post.Discoverable) return |
| 3 | + try { |
| 4 | + window.Blogs.forEach(Post => { |
| 5 | + if(!Post.Discoverable) return |
5 | 6 |
|
6 | | - if (Post.Topic.length > 20) { |
7 | | - Post.Topic = Post.Topic.substring(0,20)+".." |
8 | | - } |
| 7 | + if (Post.Topic.length > 20) { |
| 8 | + Post.Topic = Post.Topic.substring(0,20)+".." |
| 9 | + } |
9 | 10 |
|
10 | | - if (Post.Title.length > 65) { |
11 | | - Post.Title = Post.Title.substring(0,65)+".." |
12 | | - } |
| 11 | + if (Post.Title.length > 65) { |
| 12 | + Post.Title = Post.Title.substring(0,65)+".." |
| 13 | + } |
13 | 14 |
|
14 | | - if (Post.Description.length > 100) { |
15 | | - Post.Description = Post.Description.substring(0,100)+".." |
16 | | - } |
| 15 | + if (Post.Description.length > 100) { |
| 16 | + Post.Description = Post.Description.substring(0,100)+".." |
| 17 | + } |
17 | 18 |
|
18 | | - let PostThumbnail = "" |
19 | | - if (Post.Thumbnail) { |
20 | | - PostThumbnail = ` |
21 | | - <img src="./images/${Post.Thumbnail}" writea="post.entry.thumbnail" class="rounded-top-4 object-fit-cover" height="110px" width="100%"/> |
22 | | - ` |
23 | | - } |
| 19 | + let PostThumbnail = "" |
| 20 | + if (Post.Thumbnail) { |
| 21 | + PostThumbnail = ` |
| 22 | + <img src="./images/${Post.Thumbnail}" writea="post.entry.thumbnail" class="rounded-top-4 object-fit-cover" height="110px" width="100%"/> |
| 23 | + ` |
| 24 | + } |
24 | 25 |
|
25 | | - Posts = ` |
26 | | - ${Posts} |
27 | | - |
28 | | - <div writea="post.entry" class="col-12 mb-4"> |
29 | | - <a href="#read/${Post.Content.replace('.md', '')}" class="text-decoration-none text-body"> |
30 | | - <div class="rounded-4 bg-dark-subtle position-relative" style="--mdc-ripple-hover-opacity: .02; --mdc-ripple-focus-opacity: .02; --mdc-ripple-press-opacity: .05;"> |
31 | | - ${PostThumbnail} |
32 | | - <div class="row d-flex p-4"> |
33 | | - <div class="col-10 me-auto"> |
34 | | - <span writea="post.entry.info" class="d-block text-primary-emphasis mb-1"> |
35 | | - ${Post.Topic || "post"} |
36 | | - <span class="text-dark"><i class="bi bi-dot"></i> ${Post.Content}</span> |
37 | | - </span> |
38 | | - <span writea="post.entry.title" class="h5 fw-bold"> |
39 | | - ${Post.Title || "No title available"} |
40 | | - </span> |
41 | | - <span writea="post.entry.description" class="d-block"> |
42 | | - ${Post.Description || "No description available"} |
43 | | - </span> |
44 | | - </div> |
45 | | - <div class="col-auto my-auto"> |
46 | | - <button type="button" class="btn shadow-none text-primary-emphasis"><i class="bi bi-chevron-right"></i></button> |
47 | | - </div> |
48 | | - </div> |
49 | | - <span class="ripple-surface"></span> |
50 | | - </div> |
51 | | - </a> |
52 | | - </div> |
53 | | - ` |
54 | | - }); |
| 26 | + Posts = ` |
| 27 | + ${Posts} |
| 28 | + |
| 29 | + <div writea="post.entry" class="col-12 mb-4"> |
| 30 | + <a href="#read/${Post.Content.replace('.md', '')}" class="text-decoration-none text-body"> |
| 31 | + <div class="rounded-4 bg-dark-subtle position-relative" style="--mdc-ripple-hover-opacity: .02; --mdc-ripple-focus-opacity: .02; --mdc-ripple-press-opacity: .05;"> |
| 32 | + ${PostThumbnail} |
| 33 | + <div class="row d-flex p-4"> |
| 34 | + <div class="col-10 me-auto"> |
| 35 | + <span writea="post.entry.info" class="d-block text-primary-emphasis mb-1"> |
| 36 | + ${Post.Topic || "post"} |
| 37 | + <span class="text-dark"><i class="bi bi-dot"></i> ${Post.Content}</span> |
| 38 | + </span> |
| 39 | + <span writea="post.entry.title" class="h5 fw-bold"> |
| 40 | + ${Post.Title || "No title available"} |
| 41 | + </span> |
| 42 | + <span writea="post.entry.description" class="d-block"> |
| 43 | + ${Post.Description || "No description available"} |
| 44 | + </span> |
| 45 | + </div> |
| 46 | + <div class="col-auto my-auto"> |
| 47 | + <button type="button" class="btn shadow-none text-primary-emphasis"><i class="bi bi-chevron-right"></i></button> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + <span class="ripple-surface"></span> |
| 51 | + </div> |
| 52 | + </a> |
| 53 | + </div> |
| 54 | + ` |
| 55 | + }); |
| 56 | + } catch {} |
55 | 57 | return ` |
56 | 58 | ${NavigationBarElement()} |
57 | 59 | <div class="row pt-2"> |
|
0 commit comments