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

Redesign image captions #247

Merged

Conversation

kdkasad
Copy link
Contributor

@kdkasad kdkasad commented Feb 17, 2021

Changes the style of image captions. This creates a distinciton between the title and caption attributes. The former now shows up more prominently than the latter. Both are centered below the image, which resolves #246.

Since there are no pages in the example site with images, I've added one in my fork's exampleSite branch: kdkasad@e7e62d98d4356c57bc9878e7cda8d5048f743f38. Below are screenshots of the various images on that page.

Screenshots

Edit: captions are no longer centered. See this comment for updated screenshots.

Cover image with caption:
cover image

Content image with title, caption, and attribution:
image with title, caption, attr

Content image with title and caption:
image with title and caption

Content image with title:
image with title

Content image with caption:
image with caption

@adityatelange
Copy link
Owner

The issue I thought for customizing captions in #127 inside the post was Cover image is meant to be full sized and fits the width.

While in case of images inside a post, the images can be smaller than width of main hence centering the caption and title does not seem a nice idea to me.

Ex.

image

@kdkasad
Copy link
Contributor Author

kdkasad commented Feb 18, 2021

The issue I thought for customizing captions in #127 inside the post was Cover image is meant to be full sized and fits the width.

While in case of images inside a post, the images can be smaller than width of main hence centering the caption and title does not seem a nice idea to me.

Ex.

image

I didn't think of that. Should I make the captions left-aligned as they were before, or should I try to center them to the image, even if the image is smaller than the page?
Or another option is to center the whole figure, so both the image and caption are centered.

@Jarmos-san
Copy link

Centering figure makes the most sense here. That way, even if the image is smaller in width than the rest of the page, it won't look weird for the reader.

@adityatelange
Copy link
Owner

Centering figure makes the most sense here. That way, even if the image is smaller in width than the rest of the page, it won't look weird for the reader.

I am sorry but this is your preference, not everyone wants this

@kdkasad
Copy link
Contributor Author

kdkasad commented Feb 19, 2021

Centering figure makes the most sense here. That way, even if the image is smaller in width than the rest of the page, it won't look weird for the reader.

I am sorry but this is your preference, not everyone wants this

I completely understand. I've rebased the code to remove the center-alignment. Captions are now aligned according to the language's direction, which fixes the problems with images that are smaller than the page width. Here are some example images:

Left-to-right language direction

ltr

Right-to-left language direction

rtl

Right-to-left language direction with small image

rtl with small image

@Jarmos-san
Copy link

Well, these image orientations works for me too! I wouldn't mind that. Hugo's default formatting for figure just looks bland for PaperMod is what I wanted to say.

Centering it wasn't specifically for my needs, but was rather a suggestion I thought would look nice with the theme. Apologies if my suggestions sounded otherwise.

Copy link
Owner

@adityatelange adityatelange left a comment

Choose a reason for hiding this comment

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

Everything else looks good :)

assets/css/post-entry.css Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Feb 20, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@adityatelange adityatelange merged commit b71baa1 into adityatelange:master Feb 20, 2021
@kdkasad kdkasad deleted the feature/captions-rework branch February 20, 2021 05:28
@kdkasad kdkasad mentioned this pull request Apr 24, 2021
kylethedeveloper pushed a commit to kylethedeveloper/hugo-PaperMod that referenced this pull request Feb 21, 2023
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.

How to center the text in a caption?
3 participants