Skip to content

Instantly share code, notes, and snippets.

@inwardmovement
Last active January 4, 2020 10:03
Show Gist options
  • Save inwardmovement/680ecaceb42cae055db7c10257a78ffe to your computer and use it in GitHub Desktop.
Save inwardmovement/680ecaceb42cae055db7c10257a78ffe to your computer and use it in GitHub Desktop.
Add external link icon with Hugo (using CSS)
<style>
a[href^="http"]:not([href^="{{ (urls.Parse .Page.Permalink).Scheme }}://{{ (urls.Parse .Page.Permalink).Host }}"]):not(.no-external-icon)::after
{
content: 'launch';
padding-left: 4px;
position: inline-block;
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 18px;
/* display: inline-block; prevent nbsp bypass */
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
font-feature-settings: 'liga';
vertical-align: text-bottom;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment