Browse Source

Made global logo a route to the actual file.

pull/29/head
Teknikode 6 years ago
parent
commit
f039a81925
  1. 10
      Teknik/Areas/Home/HomeAreaRegistration.cs
  2. 10
      Teknik/Controllers/DefaultController.cs
  3. 2
      Teknik/Views/Shared/_Navbar.cshtml

10
Teknik/Areas/Home/HomeAreaRegistration.cs

@ -31,6 +31,16 @@ namespace Teknik.Areas.Home @@ -31,6 +31,16 @@ namespace Teknik.Areas.Home
new[] { typeof(DefaultController).Namespace }
);
// Default Routes to be applied everywhere
context.MapSubdomainRoute(
"Default.Logo", // Route name
new List<string>() { "*" }, // Subdomains
new List<string>() { config.Host, config.ShortenerConfig.ShortenerHost }, // domains
"Logo", // URL with parameters
new { controller = "Default", action = "Logo" }, // Parameter defaults
new[] { typeof(DefaultController).Namespace }
);
context.MapSubdomainRoute(
"Home.Index", // Route name
new List<string>() { "www", string.Empty }, // Subdomains

10
Teknik/Controllers/DefaultController.cs

@ -54,6 +54,16 @@ namespace Teknik.Controllers @@ -54,6 +54,16 @@ namespace Teknik.Controllers
string imageFile = Server.MapPath("~/Images/favicon.ico");
return File(imageFile, "image/x-icon");
}
// Get the Logo
[HttpGet]
[AllowAnonymous]
public ActionResult Logo()
{
// Get favicon
string imageFile = Server.MapPath("~/Images/logo-black.svg");
return File(imageFile, "image/svg+xml");
}
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]

2
Teknik/Views/Shared/_Navbar.cshtml

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="@Url.SubRouteUrl("www", "Home.Index")"><img src="/Images/logo-black.svg" height="20" alt="Teknik"></a>
<a class="navbar-brand" href="@Url.SubRouteUrl("www", "Home.Index")"><img src="@Url.SubRouteUrl("www", "Default.Logo")" height="20" alt="Teknik"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">

Loading…
Cancel
Save