Skip to content

Commit

Permalink
Merge pull request #737 from adobe/blog-list-page
Browse files Browse the repository at this point in the history
Updated layout for blog list home page
  • Loading branch information
asthabh23 authored Jan 8, 2025
2 parents 74c29e2 + f600c24 commit 3d1cf8d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
35 changes: 24 additions & 11 deletions blocks/feed/feed.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
text-align: left;
}

.feed.blog h1 {
font-size: var(--type-heading-xl-size);
line-height: var(--type-heading-xl-lh);
font-weight: 700;
letter-spacing: -0.04em;
}

.feed-container.blog .default-content-wrapper h1 {
text-align: center;
margin-top: 20px;
}

.feed-hidden {
display: none;
}
Expand Down Expand Up @@ -89,13 +101,6 @@
padding-top: var(--spacing-s);
}

.feed.blog h1 {
font-size: var(--type-heading-xl-size);
line-height: var(--type-heading-xl-lh);
font-weight: 700;
letter-spacing: -0.04em;
}

.feed.blog h2 {
font-size: var(--type-heading-l-size);
line-height: var(--type-heading-l-lh);
Expand Down Expand Up @@ -189,6 +194,18 @@
padding-top: unset;
}

.feed-container.blog .default-content-wrapper {
margin-top: 0;
}

.feed.blog h1 {
margin-top: 0;
}

.feed-container.blog .default-content-wrapper h1 {
margin-top: 0;
}

.feed.recent h3,
.feed.blog h3 {
margin-bottom: var(--spacing-s);
Expand Down Expand Up @@ -217,10 +234,6 @@
font-size: var(--type-body-m-size);
line-height: var(--type-body-s-lh);
}

.feed.blog h1 {
margin-top: 0;
}
}

@media screen and (width >= 1200px) {
Expand Down
6 changes: 6 additions & 0 deletions blocks/feed/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export async function fetchBlogContent(url) {
const text = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(text, 'text/html');
doc.querySelectorAll('h1, h2, h3, h4, h5').forEach((heading) => {
const nextLevel = `h${parseInt(heading.tagName[1], 10) + 1}`;
const newHeading = document.createElement(nextLevel);
newHeading.innerHTML = heading.innerHTML;
heading.replaceWith(newHeading);
});
const content = doc.querySelector('body > main > div');
return content ? content.innerHTML : '';
} catch (error) {
Expand Down

0 comments on commit 3d1cf8d

Please sign in to comment.