title: How do I integrate AMP in ASP.NET Core Razor Pages?
body: <p>I was hoping to find an example on Google but couldn't find any that is specific to Razor Pages. There are a couple on MVC but MVC uses a slightly different view model.</p>
  
  <p>My app is a blog. So I have a startpage with a list of blogposts and a blogpost details page and that's it.</p>
  
  <p>SEO: I'm thinking.... maybe it is enough to just create a AMP .cshml template (setting Layout to null) that be done with it. Would that work or would I be missing something?</p>
  
  <p>The goal is to serve those AMP pages so that Google can index them and list them in search results for mobile users. After the mobile user clicks on an AMP page if they want to see more posts they can simply click on the homepage link at the top of the page.</p>
  
  <p>I'm mostly just thinking out loud here since I don't have a clear picture of how to implement this in the best possible way.</p>
  
  <p>So the question is: Would a specific AMP .cshtml page be enough and are there any other Razor Pages configuration stuff I need to take into consideration? Routing for instance?</p>
  
  <p>Edit: This question is specific to Razor Pages => no dupe. MVC != Razor Pages.</p>
  
  <p>Maybe this could work?</p>
  
  <pre><code>@page "/amp/{slug}"
  @model BlogPostModel
  @{
      ViewData["Title"] = Model.BlogPost.Data.Title;
      Layout = "_LayoutAmp";
  }
  
  /* markup */
  </code></pre>