Skip to content

Commit

Permalink
create a static version of amp.dev (#6472)
Browse files Browse the repository at this point in the history
convert site to static hostable version
  • Loading branch information
patrickkettner authored Oct 26, 2022
1 parent 30a87ab commit 152b4d9
Show file tree
Hide file tree
Showing 70 changed files with 4,728 additions and 999 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier"
],
"parserOptions": {
"ecmaVersion": 2018,
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ frontend/templates/views/partials/pixi/webpack.j2
# Ignore certs from being accidentally committed
packager/certs/*pem
packager/certs/*pem.enc

# Local Netlify folder
.netlify
2 changes: 1 addition & 1 deletion examples/source/1.components/amp-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
noloading
layout="fixed-height"
height="654"
src="/documentation/examples/api/slow-json-with-items/?delay=10000"
src="/documentation/examples/api/slow-json-with-items/?delay=5000"
binding="no">
<div placeholder>
<div class="product">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
width="auto"
height="250"
layout="fixed-height"
src="/documentation/examples/api/slow-json/?delay=10000"
src="/documentation/examples/api/slow-json/?delay=5000"
binding="no">
<template type="amp-mustache">
<div>
Expand Down
81 changes: 0 additions & 81 deletions examples/source/personalization/OAuth2_Login/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion examples/static/samples/files/payments.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
var regex = new RegExp("[?&]" + name + "(=([^#&]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
Expand Down
130 changes: 65 additions & 65 deletions frontend/templates/views/partials/search.j2
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@

<div class="ap-o-search-result" id="searchResult" tabindex="-1">
<amp-state id="search"
src="{{ base_url }}/search/highlights?locale={{ doc.locale }}"
[src]="query == null || clear ? '{{ base_url }}/search/highlights?locale={{ doc.locale }}' : '{{ base_url }}/search/do?q=' + encodeURIComponent(query) + '&locale={{ doc.locale }}'"></amp-state>
src="{{ base_url }}/search/highlights/{{ doc.locale }}.json"
[src]="query == null || clear ? '{{ base_url }}/search/highlights/{{ doc.locale }}.json' : '{{ base_url }}/search/do?q=' + encodeURIComponent(query) + '&locale={{ doc.locale }}'"></amp-state>
<amp-list id="searchList"
src="{{ base_url }}/search/highlights?locale={{ doc.locale }}"
[src]="query == null || clear ? '{{ base_url }}/search/highlights?locale={{ doc.locale }}' : '{{ base_url }}/search/do?q=' + encodeURIComponent(query) + '&locale={{ doc.locale }}'"
src="{{ base_url }}/search/highlights/{{ doc.locale }}.json"
[src]="query == null || clear ? '{{ base_url }}/search/highlights/{{ doc.locale }}.json' : '{{ base_url }}/search/do?q=' + encodeURIComponent(query) + '&locale={{ doc.locale }}'"
binding="no"
items="."
height="80vh"
Expand All @@ -76,70 +76,70 @@
single-item
>

<template type="amp-mustache" id="searchResultTemplate">
<div class="ap-o-search-result-list">
{{'{{^prevUrl}}'}}
{{'{{#result.components.length}}'}}
<h4 class="ap-o-search-result-category">
{{-'{{#initial}}'}}{{_('Important Components')}}{{'{{/initial}}'-}}
{{-'{{^initial}}'}}{{_('Components')}}{{'{{/initial}}'-}}
<template type="amp-mustache" id="searchResultTemplate">
<div class="ap-o-search-result-list">
{{'{{^prevUrl}}'}}
{{'{{#result.components.length}}'}}
<h4 class="ap-o-search-result-category">
{{-'{{#initial}}'}}{{_('Important Components')}}{{'{{/initial}}'-}}
{{-'{{^initial}}'}}{{_('Components')}}{{'{{/initial}}'-}}
</h4>
{{'{{/result.components.length}}'}}
{{'{{/prevUrl}}'}}
{{'{{#result.components}}'}}
<div class="ap-o-search-result-item ap-o-search-result-item-highlight">
<a class="ap-o-search-result-link" href="{{'{{url}}'}}">
<h4 class="ap-o-search-result-title">
{{-'{{#initial}}'}}&lt;{{'{{title}}'}}&gt;{{'{{/initial}}'-}}
{{-'{{^initial}}'}}{{'{{title}}'}}{{'{{/initial}}'-}}
</h4>
{{'{{/result.components.length}}'}}
{{'{{/prevUrl}}'}}
{{'{{#result.components}}'}}
<div class="ap-o-search-result-item ap-o-search-result-item-highlight">
<a class="ap-o-search-result-link" href="{{'{{url}}'}}">
<h4 class="ap-o-search-result-title">
{{-'{{#initial}}'}}&lt;{{'{{title}}'}}&gt;{{'{{/initial}}'-}}
{{-'{{^initial}}'}}{{'{{title}}'}}{{'{{/initial}}'-}}
</h4>
<p class="ap-o-search-result-description">{{'{{description}}'}}</p>
</a>
{{'{{#exampleUrl}}'}}
<div class="ap-o-search-result-linklist">
<a class="ap-o-search-result-linklist-item ap-o-search-result-linklist-item-example ap-m-lnk" href="{{'{{exampleUrl}}'}}">
<div class="ap-a-ico ap-m-lnk-icon">
<svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#internal"></use></svg>
</div>
<span class="ap-m-lnk-text">{{_('Open example')}}</span>
</a>
{{'{{#playgroundUrl}}'}}
<a class="ap-o-search-result-linklist-item ap-o-search-result-linklist-item-playground ap-m-lnk" href="{{'{{playgroundUrl}}'}}" target="_blank">
<div class="ap-a-ico ap-m-lnk-icon">
<svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#internal"></use></svg>
</div>
<span class="ap-m-lnk-text">{{_('Open in playground')}}</span>
</a>
{{'{{/playgroundUrl}}'}}
<p class="ap-o-search-result-description">{{'{{description}}'}}</p>
</a>
{{'{{#exampleUrl}}'}}
<div class="ap-o-search-result-linklist">
<a class="ap-o-search-result-linklist-item ap-o-search-result-linklist-item-example ap-m-lnk" href="{{'{{exampleUrl}}'}}">
<div class="ap-a-ico ap-m-lnk-icon">
<svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#internal"></use></svg>
</div>
{{'{{/exampleUrl}}'}}
</div>
{{'{{/result.components}}'}}

{{'{{^prevUrl}}'}}
{{'{{#result.pages.length}}'}}
<h4 class="ap-o-search-result-category">
{{-'{{#initial}}'}}{{_('Popular Articles')}}{{'{{/initial}}'-}}
{{-'{{^initial}}'}}{{_('Results')}}{{'{{/initial}}'-}}
</h4>
{{'{{/result.pages.length}}'}}
{{'{{/prevUrl}}'}}
{{'{{#result.pages}}'}}
<div class="ap-o-search-result-item">
<a class="ap-o-search-result-link" href="{{'{{url}}'}}">
<h4 class="ap-o-search-result-title">{{'{{title}}'}}</h4>
<p class="ap-o-search-result-description">{{'{{description}}'}}</p>
</a>
</div>
{{'{{/result.pages}}'}}

{{'{{#result.isTruncated}}'}}
<div class="ap-o-search-result-hint">
{{_('Although there are {hits} hits in total we cannot show more than 100.', hits='{'+'{result.totalResults}'+'}')}}
</div>
{{'{{/result.isTruncated}}'}}
<span class="ap-m-lnk-text">{{_('Open example')}}</span>
</a>
{{'{{#playgroundUrl}}'}}
<a class="ap-o-search-result-linklist-item ap-o-search-result-linklist-item-playground ap-m-lnk" href="{{'{{playgroundUrl}}'}}" target="_blank">
<div class="ap-a-ico ap-m-lnk-icon">
<svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#internal"></use></svg>
</div>
<span class="ap-m-lnk-text">{{_('Open in playground')}}</span>
</a>
{{'{{/playgroundUrl}}'}}
</div>
</template>
{{'{{/exampleUrl}}'}}
</div>
{{'{{/result.components}}'}}

{{'{{^prevUrl}}'}}
{{'{{#result.pages.length}}'}}
<h4 class="ap-o-search-result-category">
{{-'{{#initial}}'}}{{_('Popular Articles')}}{{'{{/initial}}'-}}
{{-'{{^initial}}'}}{{_('Results')}}{{'{{/initial}}'-}}
</h4>
{{'{{/result.pages.length}}'}}
{{'{{/prevUrl}}'}}
{{'{{#result.pages}}'}}
<div class="ap-o-search-result-item">
<a class="ap-o-search-result-link" href="{{'{{url}}'}}">
<h4 class="ap-o-search-result-title">{{'{{title}}'}}</h4>
<p class="ap-o-search-result-description">{{'{{description}}'}}</p>
</a>
</div>
{{'{{/result.pages}}'}}

{{'{{#result.isTruncated}}'}}
<div class="ap-o-search-result-hint">
{{_('Although there are {hits} hits in total we cannot show more than 100.', hits='{'+'{result.totalResults}'+'}')}}
</div>
{{'{{/result.isTruncated}}'}}
</div>
</template>

<amp-list-load-more load-more-button>
<div class="ap-o-search-result-load-button" overflow>
Expand Down
Loading

0 comments on commit 152b4d9

Please sign in to comment.