zoukankan      html  css  js  c++  java
  • Orchard运用

    Favicon其实是访问其网站时在浏览器地址栏最前边呈现的类似logo的图标,可以作为品牌的标识,一般是其网站logo的缩小版并一般是ico格式的图片。详细解释可看这里:

    Favicon - 维基百科,自由的百科全书

    Favicon - 百度百科

    对Orchard系统默认支持呈现这一辨识,其图标地址为:

    /modules/orchard.themes/Content/orchard.ico

    在源代码里默认生成如下:

    <link href="/modules/orchard.themes/Content/orchard.ico" rel="shortcut icon" type="image/x-icon" />
    

    然而如上所说,一般我们都需要定制添加自己网站的Favicio图标。今天就跟大家分享如何设置网站Favicon标识:

    1.最简单的当然是直接替换上边路径的Favicon图片,不过缺点很明显,下次更新时会被覆盖。

    2. 通过模块设置,目前有一个模块"Vandelay.Industries", 其中包含一个子模块"Favicio"是貌似可以设置,不过我尝试在Orchard 1.8下不起作用。

    3. 暴力替换,就是通过当前主题theme来实现。首先找到核心呈现Favicio的View/sharp文件 - $ROOT/Orchard/Core/Shapes/Views/Document.cshtml, 拷贝到当前主题的目录Views下,记事本打开并编辑如下:

    @using Orchard.Mvc.Html;
    @using Orchard.UI.Resources;
    @{
        RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/Media/Default/favicon/orchard_blog.ico")});
        Script.Include("html5.js").UseCondition("lt IE 9").AtHead();
    
        string title = Convert.ToString(Model.Title);
        string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);
    }
    <!DOCTYPE html> 
    <html lang="@WorkContext.CurrentCulture" class="static @Html.ClassForPage()"> 
    <head> 
    <meta charset="utf-8" />
    <title>@Html.Title(title, siteName)</title> 
    @Display(Model.Head)
    <script>(function(d){d.className="dyn"+d.className.substring(6,d.className.length);})(document.documentElement);</script> 
    </head> 
    <body>
    @* Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@
    @Display(Model.Body)
    @Display(Model.Tail)
    </body>
    </html>
    

    注意:其实你修改就是这里 - Url.Content("~/Media/Default/favicon/orchard_blog.ico"),此路径必须是你要替换的图标并其已经上传到指定目录下的。

    提示:第三种方法也有缺点,就是如果你是多站点可能就不起每个站点配置不同的Favicio图标,除非你应用不同的主题。

    相关资源链接*

    Building a favicon module for Orchard

    Where is the default Orchard favicon located?

    必备模块Vandelay Industries(一):Vandelay Meta

    Orchard SEO 之利用Url候补为任何页面添加Meta及覆盖Title

  • 相关阅读:
    redis主从同步
    redis持久化
    redis发布订阅
    mariadb主从复制,
    nginx+uwsgi+django+virtualenv+supervisor发布web服务器
    Oracle 11gR2 RAC Installation on Oracle Linux 6.5
    ORA-1555 causes and solutions
    Linux实时查看日志的四种命令详解
    Linux查看日志常用命令
    oracle 11g 静默安装
  • 原文地址:https://www.cnblogs.com/sunwangji/p/3703812.html
Copyright © 2011-2022 走看看