Created
December 27, 2019 13:40
-
-
Save SethBuilder/6fdb662c45557584fa712d8d3e1b87af to your computer and use it in GitHub Desktop.
This Laravel Blade AMP page creates Instagram-like stories like this: https://envago.io/story/top-10-adventure-trips-in-oman
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
<!doctype html> | |
<html ⚡> | |
<head> | |
<meta charset="utf-8"> | |
<title>{{$story->title}} | {{env('APP_NAME')}}</title> | |
<meta name="description" content="{{$story->title}}. Discover travel trends around the Middle East."> | |
<meta name="keywords" content="travel, adventures, Hiking, Abseiling, Caving, Air Balloon, Camping, Expeditions, Discover travel trends around the Middle East"> | |
<meta name="author" content="Seif Elmughrabi"> | |
<link rel="canonical" href="{{env('APP_URL')}}/story/{{$story->slug}}"> | |
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | |
<link rel="apple-touch-icon" sizes="180x180" href="https://envagomedia.imgix.net/fav/apple-touch-icon.png"> | |
<link rel="icon" type="image/png" sizes="32x32" href="https://envagomedia.imgix.net/fav/favicon-32x32.png"> | |
<link rel="icon" type="image/png" sizes="16x16" href="https://envagomedia.imgix.net/fav/favicon-16x16.png"> | |
<link rel="mask-icon" href="/fav/safari-pinned-tab.svg" color="#FF2924"> | |
<meta name="msapplication-TileColor" content="#FF2924" /> | |
<meta name="theme-color" content="#FF2924" /> | |
<link rel="manifest" href="/manifest.json"> | |
<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; | |
animation: none | |
} | |
</style> | |
</noscript> | |
<script async src="https://cdn.ampproject.org/v0.js"></script> | |
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script> | |
<script async custom-element="amp-story" src="https://cdn.ampproject.org/v0/amp-story-1.0.js"></script> | |
<script async custom-element="amp-install-serviceworker" src="https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js"></script> | |
<link href="https://fonts.googleapis.com/css?family=Oswald:200,300,400" rel="stylesheet"> | |
<style amp-custom> | |
.book { | |
display: -webkit-box; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-box-align: center; | |
-ms-flex-align: center; | |
align-items: center; | |
-webkit-box-pack: justify; | |
-ms-flex-pack: justify; | |
justify-content: space-between; | |
-webkit-box-pack: center; | |
-ms-flex-pack: center; | |
justify-content: center; | |
width: 100px; | |
height: 30px; | |
text-decoration: none; | |
border: none; | |
border-radius: 4px; | |
font-size: 18px; | |
font-weight: 400; | |
border: 1px solid #FF2924; | |
margin: 12% auto; | |
background-color: #FF2924; | |
color: white; | |
-webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.33); | |
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.33); | |
} | |
@media (min-width: 993px) { | |
.book { | |
height: 35px; | |
font-size: 20px; | |
width: 100px; | |
} | |
} | |
amp-story { | |
font-family: 'Oswald', sans-serif; | |
color: #fff; | |
} | |
amp-story-page { | |
background-color: #000; | |
} | |
h1 { | |
font-weight: bold; | |
font-size: 2.875em; | |
font-weight: normal; | |
line-height: 1.174; | |
} | |
.end { | |
justify-self: end; | |
} | |
.margin { | |
margin-left: 5%; | |
} | |
p { | |
font-weight: normal; | |
font-size: 1.3em; | |
line-height: 1.5em; | |
color: #fff; | |
} | |
q { | |
font-weight: 300; | |
font-size: 1.1em; | |
} | |
amp-story-grid-layer.bottom { | |
align-content: end; | |
} | |
amp-story-grid-layer.noedge { | |
padding: 0px; | |
} | |
amp-story-grid-layer.center-text { | |
align-content: center; | |
} | |
.wrapper { | |
display: grid; | |
grid-template-columns: 50% 50%; | |
grid-template-rows: 50% 50%; | |
} | |
.banner-text { | |
text-align: center; | |
background-color: #000; | |
line-height: 2em; | |
} | |
</style> | |
<meta property="og:title" content="{{$story->title}} | {{env('APP_NAME')}}"> | |
<meta property="og:description" content="Discover travel trends around the Middle East."> | |
<meta property="og:image" content="{{$cover->hasVideoCover() ? $cover->getVideoThumb()."?w=1200&h=1200&fit=crop" : $cover->getPromomediaAttribute()->getDesktopInspiration()."?w=1200&h=1200&fit=crop"}}"> | |
<meta property="og:url" content="{{env('APP_URL')}}/story/{{$story->slug}}"> | |
<meta property="og:type" content="website"> | |
<meta name="twitter:card" content="summary" /> | |
<meta name="twitter:site" content="@envago_io" /> | |
<meta name="twitter:title" content="{{$story->title}} | {{env('APP_NAME')}}" /> | |
<meta name="twitter:description" content="Discover travel trends around the Middle East." /> | |
<meta name="twitter:image" content="{{$cover->hasVideoCover() ? $cover->getVideoThumb()."?w=1200&h=1200&fit=crop" : $cover->getPromomediaAttribute()->getDesktopInspiration()."?w=1200&h=1200&fit=crop"}}" /> | |
<script type="application/ld+json"> | |
{ | |
"@context": "https://schema.org", | |
"@type": "NewsArticle", | |
"mainEntityOfPage": { | |
"@type": "WebPage", | |
"@id": "https://google.com/article" | |
}, | |
"headline": "{{$story->title}}", | |
"image": [ | |
"{{$cover->hasVideoCover() ? $cover->getVideoThumb()." ? w = 1200 & h = 1200 & fit = crop " : $cover->getPromomediaAttribute()->getDesktopInspiration()." ? w = 1200 & h = 1200 & fit = crop "}}" | |
], | |
"datePublished": "{{$story->created_at}}", | |
"dateModified": "{{$story->updated_at}}", | |
"author": { | |
"@type": "Person", | |
"name": "Seif Elmughrabi" | |
}, | |
"publisher": { | |
"@type": "Organization", | |
"name": "{{env('APP_NAME')}}", | |
"logo": { | |
"@type": "ImageObject", | |
"url": "https://envagomedia.imgix.net/images/android-chrome-512x512.png?w=1200&h=1200&fit=crop" | |
} | |
}, | |
"description": "These are some exciting travel trends to do the Middle East in 2019/2020." | |
} | |
</script> | |
@foreach($pages as $storypage) | |
@if($storypage->hasVideoCover()) | |
<script type="application/ld+json"> | |
{ | |
"@context": "https://schema.org", | |
"@type": "VideoObject", | |
"name": "{{$storypage->name}}", | |
"description": "{{$storypage->category->name}} in {{$storypage->locationDisplayName}}. {{str_limit(strip_tags($storypage->deets), 90, '...')}}", | |
"thumbnailUrl": "{{$cover->getVideoThumb()." ? w = 1200 & h = 1200 & fit = crop "}}", | |
"uploadDate": "{{$storypage->created_at}}", | |
"publisher": { | |
"@type": "Organization", | |
"name": "{{env('APP_NAME')}}", | |
"logo": { | |
"@type": "ImageObject", | |
"url": "https://envagomedia.imgix.net/images/android-chrome-512x512.png?w=1200&h=1200&fit=crop", | |
"width": 512, | |
"height": 512 | |
} | |
}, | |
"contentUrl": "{{$storypage->getHlsFallback()}}", | |
"embedUrl": "{{env('APP_URL')}}/story/{{$story->slug}}" | |
} | |
</script> | |
@endif | |
@endforeach | |
</head> | |
<body> | |
<!-- Cover page --> | |
<amp-story standalone title="{{$story->title}}" publisher="{{env('MEDIA_NAME')}}" publisher-logo-src="https://envagomedia.imgix.net/images/android-chrome-512x512.png?w=1200&h=1200&fit=crop" poster-portrait-src="https://envagomedia.imgix.net/images/android-chrome-512x512.png?w=1200&h=1200&fit=crop"> | |
<amp-story-page id="cover"> | |
<amp-story-grid-layer template="fill"> | |
<amp-img layout="fixed" width="1300" height="1200" src="{{$cover->hasVideoCover() ? $cover->getVideoThumb()."?w=1200&h=1200&fit=crop&crop=edges,faces" : $cover->getPromomediaAttribute()->getDesktopInspiration()."?w=1200&h=1200&fit=crop&crop=edges,faces"}}"> | |
</amp-img> | |
</amp-story-grid-layer> | |
<amp-story-grid-layer template="vertical"> | |
<div style="border-radius: 6px;padding: 10%;background-image: linear-gradient(to right, {{$cover->placeholderColor}},rgba(0,0,0,0));"> | |
<h1>{{$story->title}}</h1> | |
<p>By <a style="text-decoration: none;color: white" href="https://envago.io">envago.io</a></p> | |
</div> | |
</amp-story-grid-layer> | |
</amp-story-page> | |
@foreach($pages as $storypage) | |
@if($storypage->hasVideoCover()) | |
<!-- Page 4 video --> | |
<amp-story-page id="{{$storypage->id}}"> | |
<amp-story-grid-layer template="fill"> | |
<amp-video autoplay loop width="1320" height="1280" poster="{{$storypage->getVideoThumb()."?w=1200&h=1200&fit=crop&crop=edges,faces"}}" layout="fixed"> | |
<source src="{{$storypage->getHlsFallback()}}" type="video/mp4"> | |
</amp-video> | |
</amp-story-grid-layer> | |
@include('partials._attach') | |
</amp-story-page> | |
@else | |
<amp-story-page id="{{$storypage->id}}"> | |
<amp-story-grid-layer template="fill"> | |
<amp-img src="{{$storypage->getPromomediaAttribute()->getDesktopInspiration()."?w=1200&h=1200&fit=crop&crop=edges,faces"}}" width="1320" height="1280" layout="fixed"> | |
</amp-img> | |
</amp-story-grid-layer> | |
@include('partials._attach') | |
</amp-story-page> | |
@endif | |
@endforeach | |
<!-- Bookend --> | |
<amp-story-bookend src="/bookend.json" layout="nodisplay"></amp-story-bookend> | |
</amp-story> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Seth, can you share this project with me? I am learning laravel and really wanna make a 'story' tool for my project (its remaking a blog that i have with steroids)