Giter Site home page Giter Site logo

Comments (4)

kaushalmodi avatar kaushalmodi commented on May 18, 2024

I believe I understand that CSS a bit more.

Looks like the content of the whole icon-github class div block is replaced with \e607 glyph in the Icon font family, and you have those fonts here.

If the gitlab icon is in that font file, how do I know the glyph code? If the icon is not in there, what would be an alternative?

Thanks.

from hugo-material-docs.

digitalcraftsman avatar digitalcraftsman commented on May 18, 2024

Hello @kaushalmodi,

since this theme is a port I didn't created the original ressources. However, I looked at the upstream project.

The glyph code corresponds with an SVG icon font that you can find here. Search for Github and you should see the glyph code as another attribute of the icon. But, as you can see, the current version of the icon font doesn't have a GitLab icon.

Currently, the upstream project get a complete overhaul. In the draft of the release notes I read that GitLab and Bitbucket icons will be added once the original theme is released.

I will port the new version as well once the overhaul is finished and released. You can find the GitLab icon that I mentioned here. Adding it to the theme and a few lines of template code and CSS should allow you to display it on your website.

from hugo-material-docs.

kaushalmodi avatar kaushalmodi commented on May 18, 2024

Thanks! I tried the below but it did not work ..

  1. I downloaded the gitlab-white.svg to /static/images/. (also tried copying it to /images/.)
  2. Put the below in partials/header.html:
{{ with .Site.Social.gitlab }}
<div class="button button-gitlab" role="button" aria-label="Gitlab">
    <a href="https://gitlab.com/u/{{ . }}" title="@{{ . }} on Gitlab" target="_blank" class="toggle-button icon icon-gitlab"><img src="/images/gitlab-white.svg"></a>
</div>
{{ end }}

But I get this:
image

from hugo-material-docs.

kaushalmodi avatar kaushalmodi commented on May 18, 2024

OK, I finally got this working.. need to added the below to config.toml:

canonifyurls = true

Can you please explain what that option means? I copied it from an example hugo blog config.

How can I not set that option and still have the below work (which now works! with the above setting):

{{ with .Site.Social.gitlab }}
<div class="button button-gitlab" role="button" aria-label="Gitlab">
    <a href="https://gitlab.com/u/{{ . }}" title="@{{ . }} on Gitlab" target="_blank" class="toggle-button icon icon-gitlab"><img src="/images/gitlab-white.svg" height="28" width="28"></a>
</div>

I have copied the .svg file to /static/images/ directory.

Caveat: Had to hard-code the image size to 28 to get the below:

image

Would you recommend a better way?

Thanks!

from hugo-material-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.