hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

Add [future]/[expired] to future/expired posts

Open foosel opened this issue 2 years ago • 3 comments
trafficstars

What does this PR change? What problem does it solve?

This PR adds [future] and [expired] labels to the post title in listings/single entry view, similarly to the existing [draft] logic.

Those labels will show up next to affected posts, if they are rendered (hugo -F -E was used). Helps to visually distinguish these post types during editing, just like [draft] does.

Example:

Screenshot_20230122_134801_Firefox

Logic is

  • future: Date is set and after now
  • expired: ExpiryDate is set and before now

If there's any way to get this determined directly by Hugo I'd love to use that instead, however I couldn't find something as convenient as .Draft for either future or expired state (still a very Hugo newbie).

Was the change discussed in an issue or in the Discussions before?

Closes #1119

PR Checklist

  • [ ] This change adds/updates translations and I have used the template present here.
  • [x] I have enabled maintainer edits for this PR.
  • [x] I have verified that the code works as described/as intended.
  • [ ] This change adds a Social Icon which has a permissive license to use it.
  • [x] This change does not include any CDN resources/links.
  • [x] This change does not include any unrelated scripts such as bash and python scripts.
  • [ ] This change updates the overridden internal templates from HUGO's repository.

foosel avatar Jan 22 '23 12:01 foosel

Kudos, SonarCloud Quality Gate passed!    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
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Jan 22 '23 12:01 sonarqubecloud[bot]

Hi @foosel, I am thinking of using icons instead of text to represent the status. This is to overcome translations for these strings in future.

  • Draft - https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aedit_note%3AFILL%400%3Bwght%40400%3BGRAD%400%3Bopsz%4048 image

  • Expired - https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aevent_busy%3AFILL%400%3Bwght%40400%3BGRAD%400%3Bopsz%4048 image

  • Future - https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aevent_upcoming%3AFILL%400%3Bwght%40400%3BGRAD%400%3Bopsz%4048 image

licensing: https://developers.google.com/fonts/faq#can_i_use_any_font_in_a_commercial_product

adityatelange avatar Feb 04 '23 12:02 adityatelange

Hey. What is the status here? Would be awesome to have this feature^^

LNA-DEV avatar Oct 01 '23 10:10 LNA-DEV