Skip to content

Instantly share code, notes, and snippets.

View nfriedli's full-sized avatar

Nicolas Friedli nfriedli

View GitHub Profile
@nfriedli
nfriedli / gist:04b6ac46a3b4d164e2e73d9e5f7fd482
Created March 21, 2023 07:57
Direct URL for Google Variable Fonts
Literata:
@import url(https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,300..800;1,7..72,300..800&display=swap);
Roboto Flex:
@import url(https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,slnt,wdth,wght@8..144,-10..0,25..151,100..1000&display=swap);
@nfriedli
nfriedli / minimal-analytics.html
Created January 2, 2022 19:53
Minimal analytics for Hugo
{{ with .Site.GoogleAnalytics -}}
<script>
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@nfriedli
nfriedli / gist:1d40763fc9d3d9d48fd0ae05c018f1e0
Created April 8, 2017 22:44
Multilingual sitemap.xml for GoHugo
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}
{{ if .IsTranslated }}
<xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
{{ range .Translations }}
@nfriedli
nfriedli / gist:dbda51ba67d51b4c1699919370497005
Created April 8, 2017 22:43
GoHugo multilingual hreflang (new internal shortcode?)
{{ if .IsTranslated }}
{{ range .Translations }}
<link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
{{ end}}
{{ end }}

Keybase proof

I hereby claim:

  • I am nfriedli on github.
  • I am nfriedli (https://keybase.io/nfriedli) on keybase.
  • I have a public key ASDSDyKqpaFAnbNS-ptjM3UT2cvngU9niYHH1qxqPzUVpQo

To claim this, I am signing this object:

@nfriedli
nfriedli / facebook.html
Created August 4, 2016 22:06
Facebook Instant Articles for SPIP
[(#HTTP_HEADER{Content-type: text/xml[; charset=(#CHARSET)]})]<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>[(#NOM_SITE_SPIP|textebrut|texte_backend)]</title>
<link>#URL_SITE_SPIP/</link>
<description>[(#DESCRIPTIF_SITE_SPIP|supprimer_tags|texte_backend)]</description>
<language>#LANG</language>
<lastBuildDate><BOUCLE_maj(ARTICLES){!par date}{0,1}>[(#DATE_MODIF|date_iso)]</BOUCLE_maj></lastBuild>
<BOUCLE_articles(ARTICLES){!par date}{age < 2}>
<item>
@nfriedli
nfriedli / amp.html
Created April 9, 2016 22:02
SPIP AMP test
<BOUCLE_article(ARTICLES){id_article}>
<!doctype html>
<html amp lang="fr">
<head>
<meta charset="utf-8">
<title>#TITRE</title>
<link rel="canonical" href="[(#URL_ARTICLE|url_absolue)]" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;
@nfriedli
nfriedli / opensearch.xml
Created March 27, 2015 18:52
XML OpenSearch for frdl.ch
<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>frdl.ch</ShortName>
<Description>Recherche sur le blog frdl.ch de Nicolas Friedli</Description>
<Url type="text/html" method="get" template="http://frdl.ch/?s={searchTerms}"/>
</OpenSearchDescription>