Skip to content

Commit a6914f3

Browse files
committed
Prevent pages from being indexed unless explicitly defined
1 parent e31088c commit a6914f3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Pages/Index.cshtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
@using Duende.IdentityServer.Models
66
@model IdentityServerHost.Pages.Home.Index
77

8+
@section robots
9+
{
10+
<meta name="robots" content="index, follow, archive" />
11+
}
12+
813
<div class="welcome-page">
914
<h1>
1015
<img src="~/duende-logo.svg" class="logo">

src/Pages/Shared/_Layout.cshtml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
1414
<link rel="stylesheet" href="~/lib/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css" />
1515
<link rel="stylesheet" href="~/css/site.css" />
16+
17+
@if (IsSectionDefined("robots"))
18+
{
19+
@await RenderSectionAsync("robots")
20+
}
21+
else
22+
{
23+
<meta name="robots" content="noindex" />
24+
}
1625
</head>
1726
<body>
1827
<partial name="_Nav" />
@@ -26,4 +35,4 @@
2635

2736
@RenderSection("scripts", required: false)
2837
</body>
29-
</html>
38+
</html>

0 commit comments

Comments
 (0)