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

Provide a way to add link to the "logo" so we can point it to some place like homepage #891

Open
rajaraodv opened this issue Sep 30, 2018 · 2 comments
Labels
type: feature request Request to add a new feature

Comments

@rajaraodv
Copy link

Feature request

I'm glad that you have a logo parameter in the theme config. But I think it doesn't allow us to add a link. Usually the logo link points to the homepage of the website. Please add that capability.

What problem does this feature solve?

What does the proposed API look like?

  themeConfig: {
    logo: "/logo.svg",
   logoLink: "https://myhomepage.com" . // Please add this 
}

How should this be implemented in your opinion?

Are you willing to work on this yourself?**

No

@rajaraodv
Copy link
Author

Here is the workaround/hack I came up with (without ejecting) because a whole bunch of people in my company started complaining. Solution: Simply override the URL via some JS after the document is loaded using a setTimer. Put this code in the head array section within config.js

  //Hack: Make clicking on the logo go to home url
    ["script",
      {},
      `
   const logoUrlChanger = setInterval(function() {
    //Anchor above the logo image
    const homeEls = document.getElementsByClassName("home-link");
    if(homeEls.length > 0) {
      const homeEl = homeEls[0];
      homeEl.setAttribute("href", "https://YOUR-URL.com");
      homeEl.setAttribute("onclick", "document.location='https://YOUR-URL.com';return false;");
      clearInterval(logoUrlChanger);
    }

    //Actual logo image
    const logoEls = document.getElementsByClassName("logo")
    if(logoEls.length > 0) {
      const logoEl = logoEls[0]
      logoEl.setAttribute("onclick", "document.location='https://YOUR-URL.com';return false;");
      clearInterval(logoUrlChanger);
    }
   }, 1000) 

`
    ]

@aralikearachnid
Copy link

The workaround leaves console log syntax errors (doesn't seem to impact functionality though)..so it would still be great to see this implemented. Looks like there is progress with this PR but it seems blocked? #1015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request Request to add a new feature
Projects
None yet
Development

No branches or pull requests

3 participants