satnaing / astro-paper

A minimal, accessible and SEO-friendly Astro blog theme
https://astro-paper.pages.dev/
MIT License
2.53k stars 522 forks source link

header image example #128

Open diomed opened 1 year ago

diomed commented 1 year ago

please make page with header image example

satnaing commented 1 year ago

Hello, I don't quite get what you mean. Maybe you can check this blog post.

tanishqmanuja commented 1 year ago

I think the header image page might refer to a layout where you can put an image before the post title/h1 tag.

Because789 commented 11 months ago

This is pure speculation since OP isn't clear, but they might be referring to this: https://astro-paper.pages.dev/posts/how-to-configure-astropaper-theme/#configuring-logo-or-title

I was playing around with "LOGO_IMAGE.enable => true" the other day and ran into some trouble myself. The main problem is, that there is one fixed size for the LOGO_IMAGE, but there are, as far as I understand it, two possible screen sizes, below 640px and above. If I adjust the image size for above 640px, it's too big for smaller screens, and vice versa. It would be nice, if there was an option to dynamically adjust the image size. Or maybe there is one and I just missed it?

diomed commented 11 months ago

it's actually cover image in a blog that I want example of

satnaing commented 11 months ago

@Because789 You can adjust the logo for different screen sizes using max-width. configure LOGO_IMAGE inside config.ts according to your needs; but aim for large screen sizes.

Then inside Header.astro, adjust the css for the logo.

/* Header.astro */

<style>
  /* other styles */
    .logo {
      @apply absolute py-1 text-xl font-semibold sm:static sm:text-2xl
      mt-1 flex max-w-[110px] sm:mt-0 sm:max-w-none; /* add this line */
    }
</style>

Make sure to adjust max-w-[110px] andmt-1 according to your logo. Definitely there will be alternative ways to achieve this. If you're familiar with CSS, you can also use media-query for responsive styles.

satnaing commented 11 months ago

@diomed

You mean this? image

If so, it can be configured inside the frontmatter property ogImage

---
ogImage: https://github.com/satnaing/astro-paper/assets/53733092/1ef0cf03-8137-4d67-ac81-84a032119e3a
---

Or do you want an example of adding an image inside the blog post?

diomed commented 11 months ago

@satnaing

I was thinking of something like this:

https://tailwindflex.com/@anonymous/blog-article-template/fullscreen-preview

Because789 commented 11 months ago

@satnaing Thanks so much for coming back to me! You have no idea how many hours I struggled with this (I guess that I've never heard of Astro or Tailwind like a week ago, only had a vague understanding of CSS and never worked with JS ever, wasn't helpful at all :)).

Sadly, your solution didn't work for me. Maybe because I use a png image? Anyway, with your hints I finally found a way I'm satisfied with. For that I had to change the wrapper as well:

<style>
  .top-nav-wrap {
    /* @apply relative flex w-full items-start justify-between p-4 sm:items-center sm:py-8; */
    @apply flex w-full items-start justify-between p-4 sm:items-center;
    }
  .logo {
    /* @apply absolute py-1 text-xl font-semibold sm:static sm:text-2xl; */
    @apply flex max-w-[60px] sm:max-w-none;
  }
</style>

This probably breaks the template if you use a text based logo, since I removed the text-classes for readability. Considering I'm only using the logo, I'm happy with that.

Thanks so much for your work here, it's an amazing template and I already learned so much digging into it!

satnaing commented 11 months ago

@satnaing

I was thinking of something like this:

https://tailwindflex.com/@anonymous/blog-article-template/fullscreen-preview

Oh! For that, we have to deal with CSS for customization. Currently, AstroPaper doesn't support that style of cover image out of the box. But, if you wish, you can customize ogImage style with CSS.

fazi-gondal commented 5 months ago

@satnaing I was thinking of something like this: https://tailwindflex.com/@anonymous/blog-article-template/fullscreen-preview

Oh! For that, we have to deal with CSS for customization. Currently, AstroPaper doesn't support that style of cover image out of the box. But, if you wish, you can customize ogImage style with CSS.

Sir please tell me how can we do this and please add this feature in theme