forked from ampproject/amp-toolbox
-
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.
optimizer: Make dynamic component URL rewrites optional (ampproject#518)
Not everyone who self-hosts the AMP runtime has the infrastructure to support dynamic components like amp-geo, ref: https://github.com/ampproject/amphtml/blob/master/spec/amp-cache-guidelines.md#guidelines-adding-a-new-cache-to-the-amp-ecosystem Introduce option rewriteDynamicComponents that prevents modification of dynamic component URLs that would otherwise have ampUrlPrefix substituted. Two relevant tests added: rewrites_host_but_not_dynamic_components_with_rtv rewrites_host_but_not_dynamic_components_without_rtv
- Loading branch information
1 parent
9e7533c
commit 81e525d
Showing
7 changed files
with
123 additions
and
9 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
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
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
14 changes: 14 additions & 0 deletions
14
...tal/RewriteAmpUrls/rewrites_host_but_not_dynamic_components_with_rtv/expected_output.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,14 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<link rel="preload" href="/amp/v0.js" as="script"> | ||
<link rel="preload" href="/amp/v0.css" as="style"> | ||
<script async custom-element=amp-experiment src=/amp/v0/amp-experiment-0.1.js></script> | ||
<script async custom-element=amp-geo src=https://cdn.ampproject.org/rtv/001515617716922/v0/amp-geo-0.1.js></script> | ||
<script async src="/amp/v0.js"></script> | ||
<link rel=stylesheet href=/amp/v0.css> | ||
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css> | ||
<link href=https://example.com/favicon.ico rel=icon> | ||
</head> | ||
<body></body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
.../experimental/RewriteAmpUrls/rewrites_host_but_not_dynamic_components_with_rtv/input.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,19 @@ | ||
<!-- | ||
{ | ||
"ampUrlPrefix": "/amp", | ||
"ampRuntimeVersion": "001515617716922", | ||
"rewriteDynamicComponents": false | ||
} | ||
--> | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<script async custom-element=amp-experiment src=https://cdn.ampproject.org/v0/amp-experiment-0.1.js></script> | ||
<script async custom-element=amp-geo src=https://cdn.ampproject.org/v0/amp-geo-0.1.js></script> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<link rel=stylesheet href=https://cdn.ampproject.org/v0.css> | ||
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css> | ||
<link href=https://example.com/favicon.ico rel=icon> | ||
</head> | ||
<body></body> | ||
</html> |
14 changes: 14 additions & 0 deletions
14
.../RewriteAmpUrls/rewrites_host_but_not_dynamic_components_without_rtv/expected_output.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,14 @@ | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<link rel="preload" href="/amp/v0.js" as="script"> | ||
<link rel="preload" href="/amp/v0.css" as="style"> | ||
<script async custom-element=amp-experiment src=/amp/v0/amp-experiment-0.1.js></script> | ||
<script async custom-element=amp-geo src=https://cdn.ampproject.org/v0/amp-geo-0.1.js></script> | ||
<script async src="/amp/v0.js"></script> | ||
<link rel=stylesheet href=/amp/v0.css> | ||
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css> | ||
<link href=https://example.com/favicon.ico rel=icon> | ||
</head> | ||
<body></body> | ||
</html> |
18 changes: 18 additions & 0 deletions
18
...perimental/RewriteAmpUrls/rewrites_host_but_not_dynamic_components_without_rtv/input.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,18 @@ | ||
<!-- | ||
{ | ||
"ampUrlPrefix": "/amp", | ||
"rewriteDynamicComponents": false | ||
} | ||
--> | ||
<!doctype html> | ||
<html ⚡> | ||
<head> | ||
<script async custom-element=amp-experiment src=https://cdn.ampproject.org/v0/amp-experiment-0.1.js></script> | ||
<script async custom-element=amp-geo src=https://cdn.ampproject.org/v0/amp-geo-0.1.js></script> | ||
<script async src="https://cdn.ampproject.org/v0.js"></script> | ||
<link rel=stylesheet href=https://cdn.ampproject.org/v0.css> | ||
<link href=https://fonts.googleapis.com/css?foobar rel=stylesheet type=text/css> | ||
<link href=https://example.com/favicon.ico rel=icon> | ||
</head> | ||
<body></body> | ||
</html> |