Browse Source

Made global logo a route to the actual file.

tags/2.0.3
Teknikode 3 years ago
parent
commit
f039a81925

+ 10
- 0
Teknik/Areas/Home/HomeAreaRegistration.cs View File

@@ -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
- 0
Teknik/Controllers/DefaultController.cs View File

@@ -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)]

+ 1
- 1
Teknik/Views/Shared/_Navbar.cshtml View File

@@ -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