jekyll / minima

Minima is a one-size-fits-all Jekyll theme for writers.
https://jekyll.github.io/minima/
MIT License
3.39k stars 3.6k forks source link

To hide footer social_links twitter icon need manual comment into _includes/social.html #593

Closed alemens closed 2 years ago

alemens commented 3 years ago

Description

Even though no twitter declared into _config.yml, the footer social_links twitter icon still rendered. So to hide it need a manual comment into _includes/social.html

Expected behavior

If no social_links twitter declared into _config.yml I am aspecting this will not be rendered.

Steps to reproduce

Create new site
jekyll new testingbug
Modify /testingbug/Gemfile to use the GitHub version
#gem "minima", "~> 2.5"
gem "minima", git: "https://github.com/jekyll/minima"
Edit _config.yml
minima:
  social_links:
    github:  testingbug
Build and update with bundle
bundle install && bundle update
Pistos commented 3 years ago

I haven't investigated deeply, but I would suspect the config merging code in Jekyll here doesn't allow for us to unset values (only override them with other values).

So, looking at the social.html partial in the minima theme, we have lines like:

{%- if social.twitter -%}<li><a .................

I'm thinking a workaround could be to change those to:

{%- if social.twitter && !social.twitter.empty? -%}<li><a ...............

So that way we could "unset" them in our local _config.yml with:

minima:
  social_links:
    twitter: ""

[EDIT] Ah, well, I guess it won't work if Liquid won't allow executing arbitrary Ruby... :\

Pistos commented 3 years ago

I ended up working around this by using local CSS to apply display: none to the icons I didn't want.

jekyllbot commented 2 years ago

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

dflorance commented 2 years ago

The issue is still there.

If I put in my _config.yml :

It comes from the theme _config.yml which contain a default value for twitter that could be unset. By the way the same thing happens with all values like social_links.github, author.email and author.name . The easiest way would be to just comment these default values in the theme _config.yml .

Like

  title: Your awesome title
  author:
    # name: GitHub User
    # email: your-email@domain.com
  ...
    # generate social links in footer
    social_links:
      # twitter: jekyllrb
      # github:  jekyll
      # devto: jekyll
      # dribbble: jekyll
      # facebook: jekyll

Hope my comment will help.

ashmaroli commented 2 years ago

@alemens, @dflorance You'll have to instruct Jekyll to ignore the theme-config explicitly:

# in <source_dir>/_config.yml

ignore_theme_config: true
dflorance commented 2 years ago

@ashmaroli you are perfectly right ! My bad for not knowing about this option, from my perspective I think the issue can be close or stale as this option exists.