Skip to content

Commit 3d1cf8d

Browse files
authored
Merge pull request #737 from adobe/blog-list-page
Updated layout for blog list home page
2 parents 74c29e2 + f600c24 commit 3d1cf8d

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

blocks/feed/feed.css

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
text-align: left;
33
}
44

5+
.feed.blog h1 {
6+
font-size: var(--type-heading-xl-size);
7+
line-height: var(--type-heading-xl-lh);
8+
font-weight: 700;
9+
letter-spacing: -0.04em;
10+
}
11+
12+
.feed-container.blog .default-content-wrapper h1 {
13+
text-align: center;
14+
margin-top: 20px;
15+
}
16+
517
.feed-hidden {
618
display: none;
719
}
@@ -89,13 +101,6 @@
89101
padding-top: var(--spacing-s);
90102
}
91103

92-
.feed.blog h1 {
93-
font-size: var(--type-heading-xl-size);
94-
line-height: var(--type-heading-xl-lh);
95-
font-weight: 700;
96-
letter-spacing: -0.04em;
97-
}
98-
99104
.feed.blog h2 {
100105
font-size: var(--type-heading-l-size);
101106
line-height: var(--type-heading-l-lh);
@@ -189,6 +194,18 @@
189194
padding-top: unset;
190195
}
191196

197+
.feed-container.blog .default-content-wrapper {
198+
margin-top: 0;
199+
}
200+
201+
.feed.blog h1 {
202+
margin-top: 0;
203+
}
204+
205+
.feed-container.blog .default-content-wrapper h1 {
206+
margin-top: 0;
207+
}
208+
192209
.feed.recent h3,
193210
.feed.blog h3 {
194211
margin-bottom: var(--spacing-s);
@@ -217,10 +234,6 @@
217234
font-size: var(--type-body-m-size);
218235
line-height: var(--type-body-s-lh);
219236
}
220-
221-
.feed.blog h1 {
222-
margin-top: 0;
223-
}
224237
}
225238

226239
@media screen and (width >= 1200px) {

blocks/feed/feed.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export async function fetchBlogContent(url) {
5757
const text = await response.text();
5858
const parser = new DOMParser();
5959
const doc = parser.parseFromString(text, 'text/html');
60+
doc.querySelectorAll('h1, h2, h3, h4, h5').forEach((heading) => {
61+
const nextLevel = `h${parseInt(heading.tagName[1], 10) + 1}`;
62+
const newHeading = document.createElement(nextLevel);
63+
newHeading.innerHTML = heading.innerHTML;
64+
heading.replaceWith(newHeading);
65+
});
6066
const content = doc.querySelector('body > main > div');
6167
return content ? content.innerHTML : '';
6268
} catch (error) {

0 commit comments

Comments
 (0)