Commit dc4e8bb4 authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Make index.html interpolation instructions less clashing with env syntax

parent 67e6cf5a
No related merge requests found
Showing with 3 additions and 3 deletions
+3 -3
...@@ -705,11 +705,11 @@ Since Create React App doesn’t support server rendering, you might be wonderin ...@@ -705,11 +705,11 @@ Since Create React App doesn’t support server rendering, you might be wonderin
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta property="og:title" content="%OG_TITLE%"> <meta property="og:title" content="__OG_TITLE__">
<meta property="og:description" content="%OG_DESCRIPTION%"> <meta property="og:description" content="__OG_DESCRIPTION__">
``` ```
Then, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `%OG_TITLE%`, `%OG_DESCRIPTION%`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML! Then, on the server, regardless of the backend you use, you can read `index.html` into memory and replace `__OG_TITLE__`, `__OG_DESCRIPTION__`, and any other placeholders with values depending on the current URL. Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML!
If you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases. If you use a Node server, you can even share the route matching logic between the client and the server. However duplicating it also works fine in simple cases.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment