javascript - 如何使用 react.js 在 Apache 服务器上生成动态 <meta> 标签

标签 javascript apache reactjs webpack react-router-v4

我通过 facebookincubator/create-react-app 创建了一个 react.js + router v4 项目,并且我使用没有后端语言的 Apache 2 来运行我的项目。

我读过这个official doc :

Generating Dynamic Tags on the Server

Since Create React App doesn’t support server rendering, you might be wondering how to make tags dynamic and reflect the current URL. To solve this, we recommend to add placeholders into the HTML, like this:

<!doctype html>
<html lang="en">
  <head>
    <meta property="og:title" content="__OG_TITLE__">
    <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!

如果我使用 apache 运行我的项目没有任何后端语言,有没有办法生成动态标签?

谢谢。

最佳答案

关于javascript - 如何使用 react.js 在 Apache 服务器上生成动态 &lt;meta&gt; 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47885656/

相关文章:

php - Facebook 照片 API

javascript - jQuery 动画没有完成(slideUp/slideDown)

javascript - jsrender-从复杂结构中访问元素

php - 在同一台服务器上运行 PHP 和 Ruby 有什么坏处吗?

django - apache中test.example.com到example.com的重定向问题

linux - AWS EC2 上的 Apache VirtualHosts 不工作

reactjs - Apollo 突变去抖和竞争条件

javascript - 在 reactjs 中设置 componentDidMount 间隔是一种正确的方法吗?

reactjs - react-native-web:编译失败(react-native-vector-icons)

javascript - knockoutjs 可观察数组和排序函数 : UI is not updated