Skip to content

Convert blog post titles to h1 while keeping the styles #475

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bhumi1102
Copy link
Contributor

This PR addresses this SEO task

  • Update the blog post tiles and "category" headings while are displayed in the same location on /blog
  • Update styles to maintain current font size and weight, otherwise the blog post titles look too huge (screenshot attached).

@bhumi1102
Copy link
Contributor Author

CC: One more SEO task @AmandaPerino, @jathayde

@bhumi1102
Copy link
Contributor Author

Without css update, the titles look like this:

before:
Screen Shot 2025-05-01 at 10 11 44 AM
after:
Screen Shot 2025-05-01 at 10 12 31 AM

@jathayde
Copy link
Contributor

jathayde commented May 9, 2025

@bhumi1102 looking at the code we've got a few things to namespace to make this work I feel. So the headlines are defined as .common-headline hn where n is the number 1-6 and then there's a mobile-first responsive style for min-width: 1024px. This is defined in _sass/common/headline.scss.

For these particular pages, the div is classed with .post so we could say .post h1 and then copy in the H2 items either on headline.scss or post.scss (I feel the latter makes more sense.

How do you feel about that?

@bhumi1102
Copy link
Contributor Author

bhumi1102 commented May 16, 2025

For these particular pages, the div is classed with .post so we could say .post h1 and then copy in the H2 items either on headline.scss or post.scss (I feel the latter makes more sense.

Hi @jathayde - let me parse what you're saying, what do you mean by "then copy in the H2 items" above? In the diff, I've made updates to the post.scss file to add h1 styles. Though I think you're suggesting slightly different changes..

How do you feel about that?

I consider all my changes placeholders to make it work. So I'm up for whatever you suggest as the person in charge of the rails website styles :) It's not clear to me what you're suggesting though, to help clarify what you mean, do you mind using the "suggest changes" directly on the diff to make your update? So I can see what you mean. (Also up for getting on a short call if that's faster/easier - I can be available Monday 5/19 anytime between 9am - 2pm central). Thanks!

@jathayde
Copy link
Contributor

My apologies, let me step through it:

In _layouts/post.html we want to change line 14 to use H1 instead of H2 (I believe that's the core of the issue):

        <h1>{{ page.title | strip_html }}</h1>

Then, in order to not make them massively crazy, we need to modify the H1 but only for pages with a class of .post (which is not on body but on a parent div. I apologize for mistyping). So first, off we need to modify post.html again to add:

And then in _sass/modules/_post.scss we need to add this block in the &__headline (which generates out to a class of .post__headline):

  &__headline {

    margin: -7px 30px -6px 30px;
    text-align: center;

    h1 {
      color: $color-red;
      font-size: 39px;
      @media (max-width: 800px) {
        font-size: 32px;
      }
      @media (max-width: 600px) {
        font-size: 28px;
      }
      font-weight: 700;
      letter-spacing: -0.01em;
      line-height: 38px;
    }

    h5 {
      margin-bottom: 16px;
    }

    h6 {
      font-weight: 400;
      margin-top: 17px;
    }

  }

Only the h1 is new here and it's the h2 styles from _headline.scss. This should work or get us close.

@bhumi1102
Copy link
Contributor Author

bhumi1102 commented May 19, 2025

No worries @jathayde! So the above makes sense and I made the h1 changes in post.scss. The post.html change from h2 to h1 is already in my diff. With this the blog titles are h1 but don't look massive (attaching screenshot). The other 3 one-off changes in the diff are need to make the "category title" which is rendered in the same place as the blog post title not look massive.

Let me know if anything else in this PR. (I'd like to wrap up these SEO open PRs this week and merge if it works out).
Screen Shot 2025-05-19 at 1 23 56 PM

@jathayde
Copy link
Contributor

This looks good to me code wise. The one-off changes are the releases.html, etc?

@bhumi1102
Copy link
Contributor Author

This looks good to me code wise. The one-off changes are the releases.html, etc?

Yup, releases.html, news.html, foundations.html. Thanks for confirming @jathayde. This one should be good to merge I think. CC: @AmandaPerino

@zzak
Copy link
Member

zzak commented Jun 7, 2025

Couple of side-by-sides

Screenshot from 2025-06-08 06-44-30

Screenshot from 2025-06-08 06-44-44

Are the blog titles supposed to shrink in size?

Also I couldn't find where "releases" is actually used / accessible so I couldn't check that.

@bhumi1102
Copy link
Contributor Author

bhumi1102 commented Jun 9, 2025

Thanks for reviewing this one @zzak! No the blog titles are not suppose to shrink. They were missing the "desktop" styles, I've fixed this now! Attaching screenshot:

Screen Shot 2025-06-09 at 9 52 05 AM

Only change below is from h2 --> h1 (no font size change, as desired)

Screen Shot 2025-06-09 at 9 52 47 AM

@bhumi1102
Copy link
Contributor Author

bhumi1102 commented Jun 9, 2025

Also I couldn't find where "releases" is actually used / accessible so I couldn't check that.

To answer your second question @zzak, "releases" is used at /category/releases, similar to /category/news and /category/foundation. The intention is to keep these headings same as the blog post font size of 55px. (without the update to the 3 corrosponding html files, the font size is huge at 78px). Attaching screenshots:

Screen Shot 2025-06-09 at 10 18 27 AM

@bhumi1102
Copy link
Contributor Author

@AmandaPerino I've addressed all review comments on this one. I was unsure about the font-sizes before but now I've sorted through the various media sizes and made sure that we are matching the existing sizes in all cases!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants