Giter VIP home page Giter VIP logo

eleventy-plugin-inline-link-favicon's Introduction

eleventy-plugin-inline-link-favicon

Eleventy shortcodes and filters to add an inline favicon image to a link.

A screenshot of the plugins output. Links display their favicon inline.

Live Demo | Blog Demo

Install

npm install eleventy-plugin-inline-link-favicon

Configuration

Add the plugin to your .eleventy.js config file:

const pluginInlineLinkFavicon = require("eleventy-plugin-inline-link-favicon")

module.exports = (eleventyConfig) => {
	eleventyConfig.addPlugin(pluginInlineLinkFavicon)
}

Usage

This plugin comes with two mechanisms to create an inline link favicon. You can use a paired shortcode or a filter, both referenced as ai. ai is short for anchor-image.

Paired Shortcode

{% ai "https://front-end.social/@brian" %}@brian{% endai %}

returns

<a href="https://front-end.social/@brian"
	><img
		alt="favicon for https://front-end.social/@brian"
		loading="lazy"
		style="max-height: 1em; position: relative; top: 0.2em; margin-right: 0.2em"
		src="https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://front-end.social/@brian&size=128"
	/>@brian</a
>

Filter

{{ "https://front-end.social/@brian" | ai("@brian") | safe }}

returns the same as above.

Snippets / Completions

Authoring content with this plugin is aided by user-defined snippets:

  • Visual Studio Code

    {
    	"ai": {
    		"scope": "markdown,nunjucks",
    		"prefix": "ai",
    		"body": ["{% ai \"$1\"%}$2{% endai %}$0"],
    		"description": "add an inline link favicon"
    	}
    }

Credits

eleventy-plugin-inline-link-favicon's People

Contributors

bmuenzenmeyer avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

eleventy-plugin-inline-link-favicon's Issues

Document the VS Code snippet

Document how to add a vscode snippet

{
  "ai": {
    "scope": "markdown,nunjucks",
    "prefix": "ai",
    "body": ["{% ai \"$1\"%}$2{% endai %}$0"],
    "description": "add an inline link favicon"
  }
}

Improve icon resolution

i didn't notice this during initial development but it's really prominent on mobile devices

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.