Browse Source

Added new meta tags, including: CSP, robots, x-ua-compatible

tags/2.0.3
Teknikode 4 years ago
parent
commit
442bd814e6
2 changed files with 39 additions and 5 deletions
  1. 12
    0
      Teknik/Areas/Home/HomeAreaRegistration.cs
  2. 27
    5
      Teknik/Views/Shared/_Layout.cshtml

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

@@ -3,6 +3,7 @@ using System.Web.Mvc;
using System.Web.Optimization;
using Teknik;
using Teknik.Configuration;
using Teknik.Controllers;

namespace Teknik.Areas.Home
{
@@ -19,6 +20,17 @@ namespace Teknik.Areas.Home
public override void RegisterArea(AreaRegistrationContext context)
{
Config config = Config.Load();

// Default Routes to be applied everywhere
context.MapSubdomainRoute(
"Default.Favicon", // Route name
new List<string>() { "*" }, // Subdomains
new List<string>() { config.Host, config.ShortenerConfig.ShortenerHost }, // domains
"favicon.ico", // URL with parameters
new { controller = "Default", action = "Favicon" }, // Parameter defaults
new[] { typeof(DefaultController).Namespace }
);

context.MapSubdomainRoute(
"Home.Index", // Route name
new List<string>() { "www", string.Empty }, // Subdomains

+ 27
- 5
Teknik/Views/Shared/_Layout.cshtml View File

@@ -5,20 +5,42 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var startTime = new Date();
</script>
<!-- Required Meta -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- Content Restriction Policy: Where the content is allowed to come from -->
@if (!Request.IsLocal)
{
// Only have this if we aren't running on localhost
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' *.@Model.Config.Host @Model.Config.ShortenerConfig.ShortenerHost; img-src *; media-src *" />
}

<!-- What is the page's content type -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- Website Info -->
<meta name="description" content="@ViewBag.Description" />
<meta name="author" content="@Model.Config.Author" />

<!-- Robots -->
<meta name="robots" content="index,follow,noodp"><!-- All Search Engines -->

<!-- Site Verification Tags -->
<meta name="google-site-verification" content="X54N1YTsjgOc7hivpZK7RRKyvhGwaTI4BoFfxqOLlbc" />

<!-- Start of page 'load' -->
<script type="text/javascript">
var startTime = new Date();
</script>

<!-- Main Page Title -->
<title>@ViewBag.Title</title>
<link rel="shortcut icon" href="/Images/favicon.ico" type="image/x-icon" />

<!-- Favicon -->
<link href="@Url.SubRouteUrl("www", "Default.Favicon")" rel="shortcut icon" type="image/x-icon" />
<link href="@Url.SubRouteUrl("www", "Default.Favicon")" rel="apple-touch-icon-precomposed" />

@Styles.Render("~/Content/Common")
@Scripts.Render("~/bundles/common")

Loading…
Cancel
Save