Where is the default Orchard favicon located?

Topics: Customizing Orchard, Writing themes
Feb 3, 2012 at 3:10 PM

I want to replace the default Orchard favicon with my own. Where is it located in the Orchard install file directory?

 

Thanks

Oceantrain

Feb 3, 2012 at 3:48 PM

Just install the "Favicon" module ;) ... I think it's part of Vandelay Industries.

Coordinator
Feb 3, 2012 at 6:01 PM

Otherwise you can override the default Document.cshtml template where it's located. Copy/Paste it in your theme.

Coordinator
Feb 3, 2012 at 6:12 PM

Yeah, although I did write the favicon feature in Vandelay.Industries, I only recommend using it when it's important to give control over it to the site admin. Otherwise, it's much less overhead to just change it in the theme.Document.cshtml is a way to do it, but you can also do this from your layout (or from pretty much anywhere for that matter):

RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/Media/Vulu/Default/favicon/FavIcon.png")});

Feb 3, 2012 at 6:58 PM
bertrandleroy wrote:

Yeah, although I did write the favicon feature in Vandelay.Industries, I only recommend using it when it's important to give control over it to the site admin. Otherwise, it's much less overhead to just change it in the theme.Document.cshtml is a way to do it, but you can also do this from your layout (or from pretty much anywhere for that matter):

RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/Media/Vulu/Default/favicon/FavIcon.png")});

I did this but I ended up with two entries.  How do I replace the existing one?

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

Thanks.

Coordinator
Feb 3, 2012 at 8:58 PM

Here is what the favicon feature is doing:

var links = resourceManager.GetRegisteredLinks();
var currentFavicon = links
    .Where(l => l.Rel == "shortcut icon" && l.Type == "image/x-icon")
    .FirstOrDefault();// Modify if found
if (currentFavicon != default(LinkEntry)) {
    currentFavicon.Href = faviconUrl;
}else {
    // Add the new one
    resourceManager.RegisterLink(new LinkEntry {
        Type = "image/x-icon",
        Rel = "shortcut icon",
        Href = faviconUrl
    });
}

Feb 3, 2012 at 10:16 PM
sebastienros wrote:

Otherwise you can override the default Document.cshtml template where it's located. Copy/Paste it in your theme.

I just used this answer.

Coordinator
Feb 3, 2012 at 10:42 PM

told'ya

Feb 7, 2012 at 10:48 PM

How do you use the Vandelay Induistries Favicon to upload new Icon? It's not in setting or Media? How do you use this Module?

Feb 7, 2012 at 10:48 PM
Edited Feb 7, 2012 at 10:54 PM

r

Feb 7, 2012 at 10:54 PM
Slater wrote:
sebastienros wrote:

Otherwise you can override the default Document.cshtml template where it's located. Copy/Paste it in your theme.

I just used this answer.

Where is the Document.cshtml template? I'm using Shape tracing tool and I don't see it as an option in any Altrnate Shapes or Templates?

Coordinator
Feb 7, 2012 at 10:55 PM

Let me quote the help text that is right under the favicon URL setting in the admin UI: "Upload favicon files into a favicon folder in the Media module."

Feb 12, 2012 at 11:58 PM

Copy document.cshtml from safemode theme and into your own theme view folder, and change url. You also can register touch-icon there. document.cshtml seldom got chance to override but does not mean it could not be override.

Feb 13, 2012 at 3:49 PM
bertrandleroy wrote:

Let me quote the help text that is right under the favicon URL setting in the admin UI: "Upload favicon files into a favicon folder in the Media module."

I did this. Nothing happened.  Any other instructions I am missing?

Feb 13, 2012 at 3:54 PM

Oceantrain, just copy Document.cshtml into your theme and override the favicon html tag that is in there. Copy it from the Orhcard source, in Orchard.Web\Themes\SafeMode\Views\Document.cshtml

You could have found this out by doing some more research on your own. I believe it is in the documentation; if not there, it has been discussed in these forums.  

Feb 13, 2012 at 4:22 PM

Hey! The Monarch! I did my research on this! I followed the steps in this forum! I copied the shite from SafeMode/Document.cshtml! This exactly:

@{    RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/Media/favicon/favicon.ico")});}

 

I also added these using statements

 

@using Orchard.Mvc.Html;

@using Orchard.UI.Resources;

 

Still showing the Orchard favicon!

 

And watch your tone with me on this forum Jerk! I guess you must be a real man -- hiding behind some internet forum and mouthing off to me!

 

The biggest flaws of Orchard so far is it is not User Friendly. (Which is what makes a successful CMS).

The Vandelay Favicon Module should simply upload a Favicon and be done with it. Which it doesn't. You have to go digging around through different files and copying and pasting other code and overriding other people code?!? This does not make for a successful CMS. For something simple as uploading a favicon! At this point my experience with Orchard is the developers expect people to read there minds instead of having obvious, explicit instructions or functionality built into the site.

 

Don't get me wrong. I like Orchard. Because I like MVC. And I like the idea of a CMS. But this Orchard has loooong way to go.

Feb 13, 2012 at 4:35 PM

I was trying to help, no need to get all worked up. The info about how themes work, and how to override document.cshtml are in the docs (http://docs.orchardproject.net/Documentation/Anatomy-of-a-theme).

Did you copy that snippet from Document.cshtml into some other file, or did you copy the entire Document.cshtml into the "Views" folder of your theme? You need to copy the *file* itself into your theme. To verify that you are doing it right up to that point, put some debug output (e.g., add "Hello" message somewhere in there and see if you get that in your view source on your browser). If you get your debugging output, then modify the favicon part. If you don't get your debug statements post back here. 

Feb 13, 2012 at 4:36 PM

Also, there needn't be any @using statements involved when overriding Document.cshtml from your theme. 

Feb 13, 2012 at 4:57 PM

I copied the entire Document.cshtml file into my Views folder in My theme. I got "Hello World " Out put on my webpage. IN the view source I see the link to my favicon, however it is broken upon opening and yet it still displays Orchard favicon.

 

see for yourself:

 

http://training.pryor.com

 

Thanks

Feb 13, 2012 at 5:22 PM

1. It is not showing the Orchard icon. You might be seeing an Orchard icon that your browser has cached. 

2. I think something is wrong with your image, not anything to do with Orchard or Document.cshtml. You were able to successfully override the default location of the favicon to point to your file at Media/favicon/favicon.ico. That image is blank when I try to view it in my browser -- i don't see any image. But the browser seems to think the image is 18x20px, so I an image is there. I opened it with GIMP and i do see a logo. So you maybe need to flatten it or something, i'm not sure. 

Feb 13, 2012 at 6:20 PM

Thank you Monarch. Editing the image solved the problem.

 

Sorry about earlier.