-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
860d8a4
commit 4cf5c8f
Showing
16 changed files
with
4,269 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const SERVICE_BASE = `https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=%%URL%%&size=%%SIZE%%` | ||
|
||
module.exports = (eleventyConfig, options) => { | ||
const defaults = { | ||
size: "1", | ||
} | ||
|
||
eleventyConfig.addPairedShortcode("ai", function (content, href, size = 1) { | ||
return `<a href="${href}"><img style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" src="${SERVICE_BASE.replace("%%URL%%", href).replace("%%SIZE%%", size)}"/>${content}</a>` | ||
}) | ||
|
||
eleventyConfig.addFilter("ai", (href, text) => { | ||
const { size } = { | ||
...defaults, | ||
...options, | ||
} | ||
|
||
return `<a href="${href}"><img style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" src="${SERVICE_BASE.replace( | ||
"%%URL%%", | ||
href | ||
).replace("%%SIZE%%", size)}"/>${text}</a>` | ||
}) | ||
return { | ||
markdownTemplateEngine: "njk", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,2 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
node_modules | ||
_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.editorconfig | ||
.prettierrc.js | ||
_includes | ||
_site | ||
tests | ||
index.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
save-exact=true | ||
audit=false | ||
fund=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
semi: false, | ||
useTabs: true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,57 @@ | ||
# eleventy-plugin-inline-link-favicon | ||
# eleventy-plugin-inline-link-favicon | ||
|
||
Eleventy shortcodes and filters to add an inline favicon image to a link. | ||
|
||
![]() | ||
|
||
## Install | ||
|
||
```bash | ||
npm install eleventy-plugin-inline-link-favicon | ||
``` | ||
|
||
## Configuration | ||
|
||
Add the plugin to your `.eleventy.js` config file: | ||
|
||
```js | ||
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](https://www.11ty.dev/docs/shortcodes/#paired-shortcodes) or a [filter](https://www.11ty.dev/docs/filters/), both referenced as `ai`. `ai` is short for anchor-image. | ||
|
||
## Paired Shortcode | ||
|
||
```md | ||
{% ai "https://front-end.social/@brian" %}@brian{% endai %} | ||
``` | ||
|
||
returns | ||
|
||
```html | ||
<a href="https://front-end.social/@brian" | ||
><img | ||
style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" | ||
src="https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://front-end.social/@brian&size=1" | ||
/>@brian</a | ||
> | ||
``` | ||
|
||
## Filter | ||
|
||
```md | ||
{{ "https://front-end.social/@brian" | ai("@brian") | safe }} | ||
``` | ||
|
||
returns the same as above. | ||
|
||
## Credits | ||
|
||
- Thanks to [5t3ph/eleventy-plugin-template](https://github.com/5t3ph/eleventy-plugin-template) for inspiration | ||
- Thanks to this [blog by Jim Nielsen](https://blog.jim-nielsen.com/2021/displaying-favicons-for-any-domain/) as inspiration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Test Page - eleventy-plugin-inline-link-favicon</title> | ||
</head> | ||
<body> | ||
{{ content | safe }} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
layout: base.njk | ||
--- | ||
|
||
# Eleventy Plugin Inline Link Favicon | ||
|
||
{%ai "https://github.com/bmuenzenmeyer/eleventy-plugin-inline-link-favicon"%}docs on github{% endai%} | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing {% ai "https://brianmuenzenmeyer.com/book/" %}book{% endai %}. Pellentesque sit amet ultricies massa. Donec dolor nisi, mattis blandit justo vel, consectetur mollis nisl. Etiam aliquet tempus arcu, eu tincidunt diam egestas ut. Nulla facilisi. Nullam cursus est eu est consectetur pellentesque. Proin vitae risus luctus, iaculis lacus at, elementum {{ "https://www.washingtonpost.com/" | ai("Washington Post") | safe }}. In hac habitasse platea dictumst. Phasellus non convallis est. Mauris quis diam vestibulum, elementum risus non, hendrerit massa. Integer suscipit nisi id egestas faucibus. Cras maximus erat at augue dictum sodales. Sed pretium sem ac dui ullamcorper, ac venenatis felis varius. | ||
|
||
- Paired Shortcode: {% ai "https://www.11ty.dev/docs/shortcodes/#paired-shortcodes" %}paired shortcode docs{% endai %} | ||
- Filter: {{ "https://www.11ty.dev/docs/filters/" | ai("filter docs") | safe }} | ||
|
||
## All Syntaxes | ||
|
||
- [.njk](/tests/nunjucks/) | ||
- [.liquid](/tests/liquid/) | ||
- [.11ty.js](/tests/javascript/) | ||
- [.md](/tests/markdown) | ||
- [.hbs](/tests/handlebars) | ||
|
||
## Default Icon | ||
|
||
{% ai "http://example.com" %}example.com{% endai %} - no favicon found | ||
|
||
## {{ "https://www.11ty.dev/plugins/" | ai("11ty Plugins") | safe }} | ||
|
||
This plugin is one of many cool plugins you should check out! | ||
How does the image scale in a heading? | ||
|
||
--- | ||
|
||
Look, a mock footer usecase! | ||
|
||
{% ai "https://front-end.social/@brian" %}@brian{% endai %} | {% ai "https://github.com/bmuenzenmeyer" %}@bmuenzenmeyer{% endai %} | {% ai "https://www.linkedin.com/in/brian-muenzenmeyer-91a77554/" %}Brian Muenzenmeyer{% endai %} |
Oops, something went wrong.