astro-accelerator 6.0.13 → 6.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.0.13",
2
+ "version": "6.0.14",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -859,6 +859,7 @@ code {
859
859
  }
860
860
 
861
861
  pre.astro-code {
862
+ border-radius: var(--block-radius);
862
863
  font-family: var(--code-font);
863
864
  margin: var(--block-gap) 0;
864
865
  overflow: auto;
@@ -60,6 +60,7 @@ function unique(value, index, array) {
60
60
  tags: string[];
61
61
  url: string;
62
62
  date: string;
63
+ bannerImage: { src: string; alt: string } | null;
63
64
  matchedHeadings: Heading[];
64
65
  }
65
66
  } SearchEntry
@@ -375,9 +376,22 @@ function initializeSearch() {
375
376
  li.dataset.score = (
376
377
  Math.round((needle.score / total) * 1000) / 1000
377
378
  ).toString();
378
- listElementWrapper.appendChild(path);
379
- listElementWrapper.appendChild(listElementTitle);
380
- listElementWrapper.appendChild(listElementDescription);
379
+ const resultContent = document.createElement('div');
380
+ resultContent.className = 'result-content';
381
+ resultContent.appendChild(path);
382
+ resultContent.appendChild(listElementTitle);
383
+ resultContent.appendChild(listElementDescription);
384
+
385
+ if (needle.bannerImage) {
386
+ const resultImage = document.createElement('img');
387
+ resultImage.src = needle.bannerImage.src;
388
+ resultImage.alt = needle.bannerImage.alt;
389
+ resultImage.className = 'result-image';
390
+ resultImage.loading = 'lazy';
391
+ listElementWrapper.appendChild(resultImage);
392
+ }
393
+
394
+ listElementWrapper.appendChild(resultContent);
381
395
  li.appendChild(listElementWrapper);
382
396
 
383
397
  if (
@@ -70,6 +70,7 @@ const getData = async () => {
70
70
  tags: page.frontmatter.tags ?? [],
71
71
  url: SITE.url + accelerator.urlFormatter.formatAddress(url),
72
72
  date: page.frontmatter.pubDate ?? '',
73
+ bannerImage: page.frontmatter.bannerImage ?? null,
73
74
  });
74
75
  }
75
76
 
@@ -117,7 +117,22 @@ const accelerator = new Accelerator(SITE);
117
117
 
118
118
  .site-search-results-item a {
119
119
  text-decoration: none;
120
- display: block;
120
+ display: flex;
121
+ gap: 1.5rem;
122
+ align-items: flex-start;
123
+ }
124
+
125
+ .result-image {
126
+ width: 120px;
127
+ height: 120px;
128
+ object-fit: cover;
129
+ border-radius: var(--block-radius);
130
+ flex-shrink: 0;
131
+ }
132
+
133
+ .result-content {
134
+ flex: 1;
135
+ min-width: 0;
121
136
  }
122
137
 
123
138
  .site-search-results .show-more {
@@ -210,6 +225,17 @@ const accelerator = new Accelerator(SITE);
210
225
  width: unset;
211
226
  }
212
227
 
228
+ .result-wrapper {
229
+ flex-direction: column;
230
+ gap: 1rem;
231
+ }
232
+
233
+ .result-image {
234
+ width: 100%;
235
+ height: auto;
236
+ max-height: 200px;
237
+ }
238
+
213
239
  .site-search-wrapper button {
214
240
  width: 100%;
215
241
  }