javascript - 在自定义 Telescope 主题中显示域名 url

标签 javascript reactjs meteor telescope

我正在自定义 Telescope 主题,我需要的是显示帖子所在的域 url。它应该显示在 PostsItem 中。

就像 Sidebar.io 网站上存在的那样,this部分。

前几天我在 Telescope slack channel 上询问,这是我得到的建议/说明:

Check in nova:posts/helpers there maybe a function to do that automatically. Else based on the string you get from the getDomain function, make it an array divided by /, and take the first argument which will be the domain

我想这应该有帮助,我只是经验不足,无法做到这一点。所以我仍然需要这方面的帮助。

这些链接也可能有帮助: utils.jshelpers.js

我尝试添加<h3>{post.url}</h3>内部文件CustomPostsItem.jsx但我得到了完整的网址,而不仅仅是域名。

提前致谢!

最佳答案

我在 Telescope slack channel 上得到了答案,它有效。

{post.url ? <span className="post-url-domain">{Telescope.utils.getDomain(post.url)}</span> : null}

关于javascript - 在自定义 Telescope 主题中显示域名 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40178989/

相关文章:

javascript - 确定去优化的原因

javascript - chrome 47 中的 getUserMedia() 不使用 https

javascript - 正斜杠 ('/' )在追加时未创建 - jQuery

css - 每次在 Meteor 中渲染时脉冲模板

javascript - 私有(private)文件夹中的重复文件

javascript - 在 Meteor.js 中删除类别

Javascript 排序获取的数据

javascript - 媒体查询断点上的 CSS 重置值(调整窗口大小或方向更改)

reactjs - 未显示 react-native-maps 自定义 Tiles

javascript - React 如何保留渲染的组件