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 FontAwesome clickable #127

Closed
samuel-rosa opened this issue Nov 25, 2017 · 11 comments
Closed

Make FontAwesome clickable #127

samuel-rosa opened this issue Nov 25, 2017 · 11 comments

Comments

@samuel-rosa
Copy link

Is it possible to add a link to icons in Features and make FontAwesome icons clickable?

@samuel-rosa
Copy link
Author

This is my current solution:

  1. Inside folder layouts, create a folder partials;
  2. In the previous folder, make a copy of file features.html from /themes/hugo-universal-theme/layouts/partials;
  3. Find the following code (line 13 - 15):
<div class="icon">
  <i class="{{ .icon }}"></i>
</div>
  1. In line 14, add the following code:
<a href="{{ .url }}">
  1. In the YAML front matter of a feature use url to pass the website address.

Is there a cleaner, more elegant solution?

@jcolomb
Copy link

jcolomb commented May 31, 2018

The problem is that all icons get the function and there is no default page, such that you get error 404 if you do not set url in the YAML.

I have actually the probelm with the see_more parameter:
params.see_more]
enable = true
icon = "fa fa-file-code-o"
url = "/"
title = "Do you want to participate"
subtitle = "Go to our github page and sign up."
link_url = "https://github.com/open-science-promoters/RDM-promotion"
link_text = "https://github.com/open-science-promoters/RDM-promotion"

the text becomes a link to a different page set for another icon ??

@GeorgeWL
Copy link
Contributor

Just need to add a check to the partial injection then that will go
not real code

if(isExternal(url)){
link = url
}

with isExternal(url) being a regex check for if it starts with http/https/www etc

@jcolomb
Copy link

jcolomb commented Jun 11, 2018

Ok got it to work, the problem was that the href tag was not closed and the link was given to all text following. Here is the workaround: modify the feature.html like this (line12-18 to change to):

 <div class="box-simple">
                          <div class="icon">
                            <i class="{{ .icon }}"></i>
                            <a href="{{ .url }}"> 
                          </div>
                        <h3>{{ $element.name }}</h3>
                        <p>{{ $element.description | markdownify }}</p>
                        </a>
                    </div>

@GeorgeWL
Copy link
Contributor

@jcolomb fancy making a pull request for that?

@jcolomb
Copy link

jcolomb commented Jun 11, 2018

I do !

@GeorgeWL
Copy link
Contributor

go ahead and we'll review it @jcolomb

@jcolomb
Copy link

jcolomb commented Jun 12, 2018

see
#166

@salim-b
Copy link
Collaborator

salim-b commented Sep 17, 2018

see
#166

or see my comment about a (slightly different) approach

@norcalbiostat
Copy link

norcalbiostat commented Oct 7, 2018

bumping this for review - i would really like this to be implemented.
Update - followed #166 manually and got it working.

@ryanfox1985
Copy link
Contributor

ryanfox1985 commented Aug 8, 2021

I'm closing this issue because #184 implements the feature clicklable.

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

6 participants