我正在自定义 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.js和 helpers.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/