From bbe05143d8639592a451bf80752a0708c9252e2c Mon Sep 17 00:00:00 2001 From: Tristan Lee Date: Mon, 17 Jun 2024 17:27:16 -0400 Subject: [PATCH] Sync example code with guide --- .../edge-functions/basic_example.js | 2 +- .../v7-ef-htmltransform/edge-functions/esi_example.js | 2 +- .../edge-functions/esi_response_stream_example.js | 2 +- examples/v7-ef-htmltransform/public/assets/basic.html | 11 ++++++++--- .../public/assets/esi_include.html | 3 ++- .../public/assets/esi_snippet.html | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/v7-ef-htmltransform/edge-functions/basic_example.js b/examples/v7-ef-htmltransform/edge-functions/basic_example.js index 801888c6a..7b7b100fe 100644 --- a/examples/v7-ef-htmltransform/edge-functions/basic_example.js +++ b/examples/v7-ef-htmltransform/edge-functions/basic_example.js @@ -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 -->`, + ``, 'html' ); }, diff --git a/examples/v7-ef-htmltransform/edge-functions/esi_example.js b/examples/v7-ef-htmltransform/edge-functions/esi_example.js index 1a0bb8a02..e6b8d5245 100644 --- a/examples/v7-ef-htmltransform/edge-functions/esi_example.js +++ b/examples/v7-ef-htmltransform/edge-functions/esi_example.js @@ -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'; diff --git a/examples/v7-ef-htmltransform/edge-functions/esi_response_stream_example.js b/examples/v7-ef-htmltransform/edge-functions/esi_response_stream_example.js index 4154198ba..5a8da29b2 100644 --- a/examples/v7-ef-htmltransform/edge-functions/esi_response_stream_example.js +++ b/examples/v7-ef-htmltransform/edge-functions/esi_response_stream_example.js @@ -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'; diff --git a/examples/v7-ef-htmltransform/public/assets/basic.html b/examples/v7-ef-htmltransform/public/assets/basic.html index 2a568c5df..a612d1bf9 100644 --- a/examples/v7-ef-htmltransform/public/assets/basic.html +++ b/examples/v7-ef-htmltransform/public/assets/basic.html @@ -1,10 +1,15 @@ - My Basic HTML Page + Script Example -

Welcome to my basic HTML page!

-

This is a simple example of an HTML page.

+

Script Example

+

+ Script example. + +

+ Edgio Homepage + diff --git a/examples/v7-ef-htmltransform/public/assets/esi_include.html b/examples/v7-ef-htmltransform/public/assets/esi_include.html index c8609a530..8d5a2ad9e 100644 --- a/examples/v7-ef-htmltransform/public/assets/esi_include.html +++ b/examples/v7-ef-htmltransform/public/assets/esi_include.html @@ -1,9 +1,10 @@ - Edge Side Include Example + Script Example +

Script Example

diff --git a/examples/v7-ef-htmltransform/public/assets/esi_snippet.html b/examples/v7-ef-htmltransform/public/assets/esi_snippet.html index e01b6180c..9d745c631 100644 --- a/examples/v7-ef-htmltransform/public/assets/esi_snippet.html +++ b/examples/v7-ef-htmltransform/public/assets/esi_snippet.html @@ -1,4 +1,4 @@

Hello, World!

-

This HTML was added by an ESI include.

+

This snippet will be included in the response via ESI.