当前位置:网站首页>开源项目站点必备&交流区功能
开源项目站点必备&交流区功能
2022-08-01 02:31:00 【小鑫同学】
写作背景:
下面的两个截图分别来自两个开源项目,它们的文档都包含了同一个功能--聊天室,一起关注这个项目的开发者可以在一起交流关于这个项目的问题,很好的将开发者联系在了一起。
接下来我通过在我自建的导航网站【https://vp.it200.cn/】中来演示一下如何在自己的网站中增加这个聊天室的功能。
开源项目【wechaty】: https://wechaty.js.org/

开源项目【micro-app】: https://micro-zoe.github.io/micro-app/docs.html#/

GITTER:
【wechaty】和【micro-app】两个项目均采用了 Gitter 来实现的聊天室功能。Gitter 是一个聊天和网络平台,通过消息、内容和发现,帮助管理、发展和连接社区。且具有自由无限制、易于创建的特点特别适合开源项目的沟通交流。

创建一个的社区:
通过下面的两步操作就得到了一个自己的社区,我们看到社区的名字是「[email protected]/community」:



在社区下新建一个关联开源项目的房间:
可以勾选最后的那个选项会自动发起一个 PR 来修改 README,添加一个该房间的徽章方便开源项目的关注者发现这个聊天室。


快速得到集成脚本:
脚本生成:
如果你尝试打开过前面那两个开源项目的文档,你会发现它们的聊天室入口都在页面右下角且名称为【OPEN CHAT】,那我们是不是需要 COPY 一份这个样式呢?当然是不需要的,这里推荐使用Sidecar来生成配置。很简单的输入你的房间名称就可以生成,将配置 Copy 到你的开源项目站点中就可以完成配置。

集成到 VuePress2:
默认 vuepress 没有提供 index.html 文件,它是通过在 docs 目录下的 README.md 来生成的,vuepress支持解析 markdown 文件中的 vue 代码片段,所以我们上面生成的脚本可以通过在 Vue 的 onMounted 执行时动态来添加:
<script setup>
import { onMounted } from 'vue'
onMounted(() => {
((window.gitter = {}).chat = {}).options = {
room: 'IT200-OSpoon/it200.cn'
};
const script=document.createElement('script');
script.src='https://sidecar.gitter.im/dist/sidecar.v1.js';
script.defer = true;
script.async = true;
document.head.appendChild(script);
})
</script>
注:可以看到我们在 onMounted 如增加脚本的时候 room 做了修改,这也是在集成时发现的一个问题,虽然在聊天室顶部显示的是@符号,但是我们实际的room 是“-”。

结语:
今天这个聊天室功能的集成就介绍到这里,赶快为你的开源项目增加这么一个交流的空间吧~
边栏推荐
- MYSQL-Batch insert data
- 从设备树(dtb格式数据)中解析出bootargs
- Inheritance Considerations
- ROS2 series of knowledge (4): understand the concept of [service]
- Key Points Estimation and Point Instance
- IDEA does not recognize the module (there is no blue square in the lower right corner of the module)
- RTL8762DK RTC (5)
- RTL8762DK PWM (seven)
- Game Security 03: A Simple Explanation of Buffer Overflow Attacks
- date command
猜你喜欢

Browser download shortcut to desktop (PWA)
![[cellular automata] based on matlab interface aggregation cellular automata simulation [including Matlab source code 2004]](/img/7b/831998e19591ce8b90cfb2eefae0d4.png)
[cellular automata] based on matlab interface aggregation cellular automata simulation [including Matlab source code 2004]

IDEA debugging

HCIP(15)

The IDEA can't find or unable to load The main class or Module "*" must not contain The source root "*" The root already belongs to The Module "*"

解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题

Modern Enterprise Architecture Framework 1

设备树——dtb格式到struct device node结构体的转换

Daily practice of LeetCode - Circular linked list question (interview four consecutive questions)

HIRO: Hierarchical Reinforcement Learning 】 【 Data - Efficient Hierarchical Reinforcement Learning
随机推荐
Solve the problem that when IDEA creates a new file by default, right-click, new, there is no XML file
Chinese version of Pylint inspection rules
修改Postman安装路径
500 miles
设备树的树形结构到底是怎样体现的?
WebApi 打个Attribute 统一处理异常
opencv 缩小放大用哪种插值更好??
纽约大学等 | TM-Vec:用于快速同源检测和比对的模版建模向量
【分层强化学习】HIRO:Data-Efficient Hierarchical Reinforcement Learning
北京突然宣布,元宇宙重大消息
device node结构体转换成platform_device结构体
软考高级系统架构设计师系列之:系统开发基础知识
软考高级系统架构设计师系列之:信息系统基础知识
初出茅庐的小李第114篇博客项目笔记之机智云智能浇花器实战(3)-基础Demo实现
JQESAP系统里的胖接口Fat interface
Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
解决安装MySQL后,Excel打开很慢的问题
By Value or By Reference
【数据分析】基于matlab GUI学生成绩管理系统【含Matlab源码 1981期】
MYSQL query interception optimization analysis