Created
April 22, 2018 13:36
-
-
Save onedrawingperday/72aee54932c46f51e310f1e2335c5c64 to your computer and use it in GitHub Desktop.
Hugo Instagram internal shortcode
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
{{ $urlPre := "https://api.instagram.com/oembed/?url=https://www.instagram.com/p/" }} | |
{{ $id := index .Params 0 }} | |
{{ $inst := getJSON $urlPre $id "/&maxwidth=640&omitscript=true" }} | |
{{ with $inst }} | |
{{ $split := split .media_id "_" }} | |
<div class="Embed" data-ios-link="media?id={{ range first 1 $split }}{{ . }}{{ end }}&utm_source=ig_embed" data-permalink="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed" data-log-event="bodyClick" data-media-type="GraphImage" data-media-id='{{ range first 1 $split }}{{ . }}{{ end }}' data-owner-id="{{ int .author_id }}" style="background: white none repeat scroll 0% 0%; border: 1px solid rgb(219, 219, 219); border-radius: 3px; max-width: 658px; padding: 0px; width: calc(100% - 2px); box-shadow: none; display: block; margin: 0px 0px 12px;"> | |
<div class="Header"><div class="AvatarContainer"> | |
<a class="Avatar" href="https://instagram.com/{{ .author_name }}/?utm_source=ig_embed&action=profilevisit" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="profilePhotoClick" target="_blank"> | |
<img src="{{ $.Page.Params.inst_avatar | default $.Site.Params.inst_avatar }}" alt="{{ .author_name }}"> | |
</a> | |
</div><div class="HeaderText"> | |
<a class="Username" href="https://instagram.com/{{ .author_name }}/?utm_source=ig_embed&action=profilevisit" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="profileClick" target="_blank"> | |
{{ .author_name }}</a> | |
<a class="FollowButton " href="https://instagram.com/{{ .author_name }}/?utm_source=ig_embed&action=profilevisit" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="followClick" data-user-id="1619620107" target="_blank"> | |
<span class="FollowText"> | |
Follow | |
</span> | |
<span class="FollowingText"> | |
Following | |
</span> | |
</a> | |
</div> | |
</div> | |
<div class="Content EmbedFrame" style="padding-bottom: 66.4%;"> | |
<a class="EmbeddedMedia" href="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed" data-ios-link="media?id={{ range first 1 $split }}{{ . }}{{ end }}&utm_source=ig_embed" data-log-event="mediaClick" target="_blank"> | |
<img class="EmbeddedMediaImage" src="{{ .thumbnail_url }}"> | |
</a> | |
</div><div class="HoverCardCTA"> | |
<a href="https://instagram.com/{{ .author_name }}/?utm_source=ig_embed&action=profilevisit" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="goToProfileCTAClick" target="_blank"> | |
View More on Instagram | |
</a> | |
</div> | |
<div class="Feedback"> | |
<a class="Likes" href="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed&action=like" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="likeClick" target="_blank"> | |
<span class="LikeSprite embedSpriteHeartOpen"></span> | |
<span class="LikeSpriteHover embedSpriteHeartOpenRed"></span> | |
<span class="hidden">Like</span> | |
</a> | |
<a class="Comments" href="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed&action=comment" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="commentClick" target="_blank"> | |
<span class="hideText embedSpriteComment"> | |
Comment | |
</span> | |
</a> | |
<a class="Save" href="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed&action=save" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="saveClick" target="_blank"> | |
<span class="hideText embedSpriteSaveOpen"> | |
Save | |
</span> | |
</a> | |
</div> | |
{{ end }} | |
{{ if len .Params | eq 2 }}{{ if eq (.Get 1) "hidecaption" }}{{ end }}{{ else }} | |
{{ with $inst }} | |
<div class="Caption"> | |
<a class="CaptionUsername" href="https://instagram.com/{{ .author_name }}/?utm_source=ig_embed&action=profilevisit" data-ios-link="user?username={{ .author_name }}&utm_source=ig_embed" data-log-event="captionProfileClick" target="_blank"> {{ .author_name }}</a> {{ .title }} | |
</div>{{ end }}{{ end }} | |
{{ with $inst }} | |
{{ $split := split .media_id "_" }} | |
<div class="Footer"> | |
<a class="Timestamp" href="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed" data-ios-link="media?id={{ range first 1 $split }}{{ . }}{{ end }}&utm_source=ig_embed" data-log-event="timestampClick" target="_blank">{{ $date := .html | replaceRE "(<)(.*)(datetime=)" "" | replaceRE "((?:>[^>\r\n]*){5})$" "" | replaceRE "\"" "" | safeHTML }}<span class="ago" datetime="{{ $date }}"></span></a> | |
<a class="Glyph" href="https://instagram.com/p/{{ $id }}/?utm_source=ig_embed" data-ios-link="media?id={{ range first 1 $split }}{{ . }}{{ end }}&utm_source=ig_embed" data-log-event="logoClick" target="_blank"> | |
<span class="Sprite embedSpriteGlyph hideText">Instagram</span> | |
</a> | |
</div></div> | |
{{ end }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment