reactjs - React Thumbnail Preview when posting/ sharing links of URL
问题描述
I'm trying to get preview of the page from different links within my react project but it's only showing the index.html "home" preview. I understand React is a SPA, but is there a module or a method to display previews/ thumbnails when I'm sharing/ posting these links? I'm using a headless CMS with Wordpress as the backend with API calls. I would like to post preview/ thumbnails of the articles/ etc.. I create.
解决方案
我有同样的问题,这就是我解决它的方法
我已经在页面网站中添加了缩略图,可以从路线访问(你想给他一个缩略图)
作为页面的第一个元素(或者至少是你的第一张图片)
因为:缩略图链接拍摄了您网站的第一张照片
然后用 Css 确保图片不会出现,但是!警告 !不要那样做:
display : none
因为它将作为已删除的图片,不会被考虑
这是我如何做到的一个例子!
在页面的 .jsx 文件中
<div className="thumbnail">
<img src="/thumbnails/landing.png" alt=""/>
</div>
这是 sass 中的样式与 css 中的样式相同
.thumbnail
position : absolute
top : 0
z-index : -5000
width : 0px
height : 0px
img
object-fit : cover
width : 0px
height : 0px
推荐阅读
- pandas - 加入后只保留一列
- docker - 使用 SpringBoot 和 MongoDB 运行 docker-compose 后找不到错误 404
- python - spark df中是否有可以被applymap替换的函数?
- java - 如何为测试启用“--enable-preview”?
- python - 为什么后面的 Python 函数定义在稍后调用时会产生“'NoneType' object is not subscriptable”错误?
- python - 无法访问类变量python
- java - 从 Spring Data Elastic Search 4.0.0 的 SearchHits 类中获取 InnerHits 结果
- r - 如何用 R 语言运行这个 MATLAB 的命令?
- java - 如何处理卡片视图中的不同按钮 onclick 和传递意图?
- python - 如何在 discord.py rewrite 中获取成员数?