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

Add ability to open menu items in a new tab

Open cmd05 opened this issue 10 months ago • 2 comments

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

Add the ability to open specific menu items in a new tab. When an identifier begins with "ext-", it will add a target="_blank". This is independent of whether the link is an external link, so the user can decide themselves. For example, if I want to make my blog page open in a new tab:

menu:
  main:
    - identifier: "ext-blog"
      name: Blog
      url: /blog/
      # or url: https://blogsite.com 
      weight: 1

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

Inspired by this PR

This discussion to open all external links in a new tab. Hugo still has not implemented target parameter for menu items. Issue

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.

cmd05 avatar Feb 03 '25 06:02 cmd05

Thank you

rickeygong avatar Feb 18 '25 09:02 rickeygong