Skip to content

Commit

Permalink
Sync example code with guide
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlee85 committed Jun 17, 2024
1 parent 234dd0d commit bbe0514
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function handleHttpRequest(request, context) {
// Use the append() method to append the timestamp to the end of the document
// Specify 'html' as the second arguemnt to indicate the content is HTML, not plain text
d.append(
`<!-- Transformed at ${new Date().toISOString()} by Edg.io -->`,
`<!-- Transformed at ${new Date().toISOString()} by Edg.io -->`,
'html'
);
},
Expand Down
2 changes: 1 addition & 1 deletion examples/v7-ef-htmltransform/edge-functions/esi_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function handleHttpRequest(request, context) {
},
];

// Set the URL to the esi_include.html we'll be transforming
// For demo purposes, we'll fetch a local asset HTML file that contains an ESI include.
const esiIncludeSource = new URL(request.url);
esiIncludeSource.pathname = '/assets/esi_include.html';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function handleHttpRequest(request, context) {
];
const textDecoder = new TextDecoder();

// Set the URL to the esi_include.html we'll be transforming
// For demo purposes, we'll fetch a local asset HTML file that contains an ESI include.
const esiIncludeSource = new URL(request.url);
esiIncludeSource.pathname = '/assets/esi_include.html';

Expand Down
11 changes: 8 additions & 3 deletions examples/v7-ef-htmltransform/public/assets/basic.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>My Basic HTML Page</title>
<title>Script Example</title>
</head>
<body>
<h1>Welcome to my basic HTML page!</h1>
<p>This is a simple example of an HTML page.</p>
<h1>Script Example</h1>
<p>
Script example.
<!-- This is a <p> comment -->
</p>
<a href="http://edg.io/">Edgio Homepage</a>
<!-- This is a <body> comment -->
</body>
</html>
3 changes: 2 additions & 1 deletion examples/v7-ef-htmltransform/public/assets/esi_include.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Edge Side Include Example</title>
<title>Script Example</title>
</head>
<body>
<h1>Script Example</h1>
<esi:include src="/assets/esi_snippet.html" />
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<h1>Hello, World!</h1>
<p>This HTML was added by an ESI include.</p>
<p>This snippet will be included in the response via ESI.</p>
</div>

0 comments on commit bbe0514

Please sign in to comment.