跳过主要内容
Mindtouch成功中心

将作者栏添加到页面

适用于:
所有办公产品版本
角色要求:
管理
使用自定义CSS来个性化您的文档与作者的详细信息或显示文章统计。

自定义作者栏可以显示作者的图像,姓名,职称和公司。

作者酒吧的屏幕截图

    先决条件

    为作者创建自定义分类

    1. 导航网站工具>控制面板>系统设置>分类
    2. 为您的网站作者创建自定义分类“authorname”。如果您有现有的作者分类来使用,请修改以下Dekiscript代码示例以匹配。
    3. 将以下eExample代码添加到您的自定义内容标题模板中/模板:自定义/视图/ ContentHeader,并根据需要修改。
      var taglist = map.keyvalues(page.tags);var authorname ='';//在此对象中添加作者信息。用自己替换现有名称和信息。var authors = {“theresam”:{“name”:“theresa manzo”,“nameurl”:“https://www.linkedin.com/in/theresa-manzo-92788154”,“nametitle”:“产品经理”,“companyname”:“mindtouch”,“companyurl”:“//www.sabbathabali.com”,“pictureurl”:“https://success.www.sabbathabali.com/%40api/deki/files/18350/%3dtheresa_manzo?Origin = MT-Web“},”Lilym“:{”姓名“:”Lily Moessel“,”NameUrl“:”https://www.linkedin.com/in/lily-m-7097048“nametitle”:“文档架构师”,“companyname”:“mindtouch”,“companyurl”:“//www.sabbathabali.com”,“pictureurl”:“https://success.www.sabbathabali.com/%40api/deki/files/18349/%3dlily_moessel?源= mt-web“}};//终止作者信息//查看页面的标记列表,找到一个用于'authorname'的标签列表,使用正确的信息foreach(var taglist中的var tag.contains(tag.key,'authorname:')显示栏。{var authorname = string.replace(tag.value.name,'authorname:','',true);if(authorname){ 
        //如果存在if(authors [authorname] .pictureurl){
      • }
      • 'Written by ' if(authors[authorName].nameurl) { authors[authorName].name } else { authors[authorName].name; }
      • // Only show this section if a companyname is set if(authors[authorName].companyname) {
      • if(authors[authorName].nametitle) { authors[authorName].nametitle ' at ' } if(authors[authorName].companyurl) { authors[authorName].companyname } else { authors[authorName].companyname }
      • }
    } }
  • 在更新作者信息后保存您的页面var作者对象。您将需要使用Classification标记来标识对象中的每个作者。
    dekiscript代码中的author对象的截图
  • 如果您使用不同的前缀调用自定义分类,那么您将需要更新引用Authorname.在下面的代码段中,您所使用的分类的前缀。
    作者分类参考的屏幕截图
  • 导航网站工具>控制面板>品牌>自定义网站CSS.
  • 在里面所有角色CSS.文本字段,添加以下CSS。
    / *作者栏* / .mt-author-container {background:@二级容器背景颜色;边框:1PX固体@二级集装箱边界;边界半径:@边框 - 半径默认;清楚:两者;颜色:@ Tertiary-Font-Color;字体大小:85%;边缘:0 0 1EM;溢出:隐藏;填充:.5EM 1EM;} .mt-author-container ul {list-style:none; margin: 0; padding: 0; } .mt-author-container .mt-author-image { float: left; margin: 0 1em 0 0; } .mt-author-container .mt-author-image-crop { border: 1px solid @primary-container-border-color; border-radius: 50%; height: 3em; overflow: hidden; position: relative; width: 3em; } .mt-author-container .mt-author-image-crop img { display: inline; height: 100%; margin: 0 auto; width: auto; } .mt-author-container img { max-height: 3em; max-width: 3em; vertical-align: middle; }
  • 点击保存
  • 要验证作者栏工作,请使用已分配的作者的文章导航,您应该看到您的新作者栏。