{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/2019/02/deploy-preview-links","result":{"data":{"site":{"siteMetadata":{"siteUrl":"https://www.netlifycms.org"}},"markdownRemark":{"frontmatter":{"title":"Deploy Preview Links","description":"Deploy preview links from your GitHub repository are now surfaced in Netlify CMS for previewing builds of unpublished content.","date":"February 8, 2019","author":"Shawn Erquhart","twitter_image":"/img/preview-link-unpublished.png","canonical_url":null},"html":"<p>Netlify CMS 2.4.0 brings deploy preview links!</p>\n<p><img src=\"/img/preview-link-unpublished.png\" alt=\"Deploy preview link for unpublished content\"></p>\n<h2 id=\"seeing-is-believing\" style=\"position:relative;\"><a href=\"#seeing-is-believing\" aria-label=\"seeing is believing permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Seeing is believing</h2>\n<p>The editorial workflow allows editors to create draft content in Netlify CMS, and Netlify can\nprovide deploy previews of draft content, but there hasn't been a way to access links to these\npreview builds from within Netlify CMS. The preview pane in the editor is a good tool for seeing how\ncontent will look on the site, but in the words of Marvin Gaye, \"ain't nothing like the real thing!\"\nAs Mr. Gaye bemoaned the absence of his beloved, so content creators long for the warm embrace of an\nactual production build. Their words, not ours.</p>\n<h2 id=\"solution-github-statuses\" style=\"position:relative;\"><a href=\"#solution-github-statuses\" aria-label=\"solution github statuses permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Solution: GitHub Statuses</h2>\n<p><img src=\"/img/github-statuses-deploy-previews.png\" alt=\"GitHub statuses\"></p>\n<p>For sites using the GitHub (or Git Gateway with GitHub) backend, we now have deploy preview links in\nthe CMS using the <a href=\"https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub Statuses\nAPI</a>.\nMany static sites already have continuous deployment and deploy previews configured on their repo,\nand they often use statuses to provide a link to a deployment directly from a commit or pull\nrequest. To retrieve a commit status that provides a deploy preview URL, we check for a status whose\n\"context\" contains one of a list of keywords commonly associated with deploy previews.</p>\n<p>If a status is not found, nothing happens in the UI. If a status is found, but the deploy preview\nisn't ready, we provide a \"Check for Preview\" link, allowing the content editor to manually check\nback until the preview is ready:</p>\n<p><img src=\"/img/preview-link-check.png\" alt=\"Deploy preview link for unpublished content\"></p>\n<p>When the preview is ready, the \"Check for Preview\" button is replaced with a link to the content:</p>\n<p><img src=\"/img/preview-link-unpublished.png\" alt=\"Deploy preview link for unpublished content\"></p>\n<h2 id=\"deep-links\" style=\"position:relative;\"><a href=\"#deep-links\" aria-label=\"deep links permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Deep links</h2>\n<p>Deploy preview links generally direct to the root of a site, but Netlify CMS can also link straight\nto the piece of content being edited. By <a href=\"/docs/deploy-preview-links\">providing a string template</a>\nfor each collection, you can get links that go right where editors expect them to. More complex\nURL's can be constructed <a href=\"/docs/deploy-preview-links/#dates-in-preview-paths\">using date\ninformation</a> from your content files.</p>\n<h2 id=\"unpublished-vs-published\" style=\"position:relative;\"><a href=\"#unpublished-vs-published\" aria-label=\"unpublished vs published permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Unpublished vs. published</h2>\n<p>If you're not using the editorial workflow, you may not feel you need this very much. Whenever you\nsave content, it's immediatlely published, so you can navigate to your live site to see the changes.\nThat said, it's at least convenient to have a link direct to your content from the CMS, so deploy\npreview links can also work for CMS installs that do not use the editorial workflow. Instead of\nretrieving a URL from a commit status, this functionality requires setting a <code>site_url</code> in your\nconfig, and that URL is used in place of the deploy preview URL.</p>\n<h2 id=\"gitlab-and-bitbucket\" style=\"position:relative;\"><a href=\"#gitlab-and-bitbucket\" aria-label=\"gitlab and bitbucket permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>GitLab and Bitbucket</h2>\n<p>Support is coming soon for these two awesome backends! Stay tuned.</p>\n<h2 id=\"try-it-out\" style=\"position:relative;\"><a href=\"#try-it-out\" aria-label=\"try it out permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Try it out!</h2>\n<p>Deploy preview links are live in Netlify CMS 2.4.0. Please give them a try and let us know if you\nhave any problems by <a href=\"https://github.com/netlify/netlify-cms/issues/new\" target=\"_blank\" rel=\"noopener noreferrer\">opening an issue</a> or\nreaching out in our <a href=\"https://netlifycms.org/chat\" target=\"_blank\" rel=\"noopener noreferrer\">community chat</a>!</p>"}},"pageContext":{"slug":"/blog/2019/02/deploy-preview-links"}}}