Skip to content

Commit cf4dde1

Browse files
authored
Merge pull request #11 from DuendeSoftware/mb/noindex
Prevent pages from being indexed unless explicitly defined
2 parents 4f83181 + cb7d3d5 commit cf4dde1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Pages/Index.cshtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
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
<!-- Google Tag Manager (noscript) -->
914
<noscript>
1015
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MMR39D3G"
1116
height="0" width="0" style="display:none;visibility:hidden"></iframe>
1217
</noscript>
1318
<!-- End Google Tag Manager (noscript) -->
19+
1420
<div class="welcome-page">
1521
<h1>
1622
<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)