I'm using moderncv to write my CV and I'd like to use a shorthand link in the header of my CV. The command \httplink has an optional argument to do this, but this argument is not passed to \homepage.

How can I redefine \homepage to pass the shorthand link as an optional argument to \httplink in the \maketitle command without messing everything up?

An example of what I was thinking of is





\homepage[shorthand]{long link that I'd like to mask}




Except that I don't if that is the proper way to redefine homepage and this code doesn't redefine line 265 of moderncvclassic.sty where, as far as I can tell the argument of homepage is passed to httplink.

1 Answer 1


You'll have to patch \makecvhead after loading the classic style using something like etoolbox (already loaded by the class).

I've done so below, replacing the \httpslink{\@homepage} piece with a conditional based on whether you supplied a shorthand argument <desc> or not through the updated \homepage[<desc>]{<URL>}:

enter image description here



\patchcmd{\makecvhead}% <cmd>
  {\httpslink{\@homepage}}% <search>
     \httpslink{\@homepage}% Used \homepage{<URL>}
     \httpslink[\@homepage@shorthand]{\@homepage}% Used \homepage[<desc>]{<URL>}
   \fi}}% <replace>
  {}{}% <success><failure>

\RenewDocumentCommand{\homepage}{o m}{%





  • Thanks, it works fine, except for urls containing &. In that case I get an error (href@split has an extra }). I looked it up, and the solution seems to be enclose the \href{} commange in {}. How would you do it in your solution?
    – Kpantzas
    Nov 18, 2014 at 18:56
  • @Kpantzas: See the updated solution.
    – Werner
    Nov 18, 2014 at 19:17
  • Great! Applied the same patch to makelettertitle, it works like a charm!
    – Kpantzas
    Nov 18, 2014 at 20:52
  • I'm almost a decade too late, by now this MWE does not work anymore. Can you update the solution to recent changes in the moderncv class (or whatever else is not working anymore)?
    – And
    Jun 12, 2023 at 14:44
  • @And: Try with the updated answer.
    – Werner
    Jun 12, 2023 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .