Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added autoblocking for article header #33

Merged
merged 2 commits into from
Oct 20, 2023
Merged

Conversation

sergiucoman
Copy link
Collaborator

@sergiucoman sergiucoman commented Oct 19, 2023

Please always provide the GitHub issue(s) your PR is for, as well as test URLs where your change can be observed (before and after):

Fix #29

Test URLs:

@aem-code-sync
Copy link

aem-code-sync bot commented Oct 19, 2023

Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

@aem-code-sync
Copy link

aem-code-sync bot commented Oct 19, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@aem-code-sync
Copy link

aem-code-sync bot commented Oct 19, 2023

Page Scores Audits Google
/drafts/scoman/better PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

<p>${publicationDate}</p>`],
]);
div.append(articleHeaderBlock);
main.prepend(div);
Copy link
Collaborator

@andreituicu andreituicu Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I may make a suggestion here, I wrote a small dom helper script in an attempt to make the JS look as close as possible to the resulting dom. Using it would look like, if you like it:

main.prepend(
  div( //section
    buildBlock('article-header', [
      [
        main.querySelector('h1') 
      ],
      [
        p(a{ href: authorURL}, author}),
        p(publicationDate),
      ]
    ]);
  ),
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice idea.

scripts/utils.js Outdated
// eslint-disable-next-line import/prefer-default-export
export function formatDate(date) {
const d = new Date(date);
return `${months[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a built in Javascript functions for this:

d.toLocaleDateString('en-US', {
      month: 'long',
      day: '2-digit',
      year: 'numeric',
})

and we'll need to see how to correctly display it in the geosites too.

I would maybe also not create a new JS file just for this function. For the moment, until we feel like it grew too much, we can add them to scripts.js to avoid an extra request.

}


.article-byline a:any-link {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could replace this selector here: https://github.com/hlxsites/servicenow/blob/main/styles/styles.css#L227 to not duplicate the link CSS.

We can keep the font family here and cleanup in styles.css https://github.com/hlxsites/servicenow/blob/main/styles/styles.css#L240-L242

font-family: var(--ff-gilroy-bold);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not particularly fond of keeping block specific styles in global CSS, but I think this is not going to become too complex.

background-position: bottom right;
}

.article-byline p > a:hover {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocks/article-header/article-header.css Show resolved Hide resolved
@aem-code-sync
Copy link

aem-code-sync bot commented Oct 20, 2023

Page Scores Audits Google
/drafts/scoman/better PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@sergiucoman sergiucoman merged commit 347d240 into main Oct 20, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autoblock Blog Metadata
2 participants