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

Make Blog link text bold (just like e.g. Shortcodes) #441

Closed
TheChymera opened this issue Apr 16, 2022 · 7 comments
Closed

Make Blog link text bold (just like e.g. Shortcodes) #441

TheChymera opened this issue Apr 16, 2022 · 7 comments

Comments

@TheChymera
Copy link
Contributor

I have tried to make the link to the Blog section bold, similarly to the “Example Site” and “Shortcodes” sections here:

decohost_2022-04-16T19:19:34

Any ideas how I can make it bold? It seems neither markdown nor HTML code will work in the title section, and I was unable to track down the point in the code where I can selectively disable this neutralization.

Additionally, I'm thinking maybe it would be better for the default to make it bold? It is basically a section on its own, more distinct from “Example Site” and “Shortcodes” than they are from each other.

@chrillek
Copy link

Any ideas how I can make it bold?

I'd use CSS for that.

I'm thinking maybe it would be better for the default to make it bold?

Not at all. In general, users have an expection about the UX of links. Historically, they're blue. Making them bold would obscure that they're a link to many users. I for one would expect bold text to be an empasis, not a link. So if you want it, you should use CSS for your site.

@TheChymera
Copy link
Contributor Author

TheChymera commented Apr 18, 2022

Makes sense, but yeah, I don't know, it's really a section unlike all others, so it would make sense to highlight it somehow. At the very least from my perspective.

I'd use CSS for that.

Any idea what part of the CSS I should modify? I assume I'd need to derive the class which is currently used and then edit one of the HTML files to make sure it selects that class.

I was able to make sense of much of the theme over the past few days, but I wasn't able to track down where this element is styled.

@TheChymera TheChymera changed the title Make Blog link text bold (just like ) Make Blog link text bold (just like e.g. Shortcodes) Apr 18, 2022
@alex-shpak
Copy link
Owner

Hi!
So, menu where you have Blog is menu-after native hugo menu. rendered here: https://github.com/alex-shpak/hugo-book/blob/master/layouts/partials/docs/menu-hugo.html

And some docs: https://gohugo.io/content-management/menus/
There is no direct way to affect its CSS. There are 2 ways:

  1. Use .Pre and .Post fields of hugo menu to wrap elemen in a <span>
  2. Add support for class in menu params: https://gohugo.io/content-management/menus/#params

@TheChymera
Copy link
Contributor Author

@alex-shpak thanks. Still getting to grips with hugo. The following code basically gave me what I needed:

[menu]
        [[menu.after]]
                identifier = 'blog'
                name = 'Blog'
                pre = "<b>"
                url = '/posts/'
                post = "</b>"
                weight = -110

Not sure whether <b> is particularly reliable, but shows up correctly on all my devices.
I don't think I need anything more fancy, but it would be cool in principle to have full CSS control.

Is there any place where I can have my own CSS classes auto-added to the defaults (like as a separate file I can track independently)? Ideally I would like to avoid editing the standard hugo files with anything you'd be unwilling to pull, because there's only so long that my diffs will be valid. Eventually hugo-book will have changes that make the diffs incomprehensible, and if everything goes well this will be far enough in the future that I'll have forgotten what I was trying to do :D

TheChymera added a commit to TheChymera/chymeric-hugo that referenced this issue Apr 21, 2022
@alex-shpak
Copy link
Owner

for full CSS control we perhaps can add .Params.class parameter to menu, to add class to the <a> tag

alex-shpak added a commit that referenced this issue Nov 2, 2022
@alex-shpak
Copy link
Owner

Hi!
.Params.class in menu was added

Example

menu:
  # before: []
  after:
    - name: "Github"
      url: "https://github.com/alex-shpak/hugo-book"
      weight: 10
      params:
        class: bold

@y0nei
Copy link

y0nei commented Sep 3, 2023

Just a note to new people looking into this cuz i had to search a bit, for local stuff you have to specify pageRef or else the element will automatically get a target="_blank" attached to it.

[[menu.after]]
    identifier = "blog"
    pageRef= "/posts/"
    name = "Blog"
    weight = -110

    [menu.after.params]
    class = "bold"

apologies for necrobump

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

No branches or pull requests

4 participants