Skip to content

Instantly share code, notes, and snippets.

@fergalhanley
Created October 18, 2013 05:43
Show Gist options
  • Save fergalhanley/7036978 to your computer and use it in GitHub Desktop.
Save fergalhanley/7036978 to your computer and use it in GitHub Desktop.
Use this web page example to turn Google docs into a simple content manager. Create a Google Doc, publish it, copy the public link into this file and copy the file to your server. Voila! You've got a web page that will update whenever you make a change to the Google Doc.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>
My Page Title
</title>
<meta content="" name="steak" />
<link href="http://www.w3.org/StyleSheets/Core/Modernist" media="all" rel="stylesheet" type="text/css" />
<!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script><![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
/*
Put the published Google Doc URL bellow. To publish the document, in your Google Docs document,
go to File -> Publish to the web... and click 'Start Publishing'. Copy the document link and assign it
to publicDocURL here.
*/
var publicDocURL = "https://docs.google.com/document/d/1aruhM7Gy4cNWGzN3_dt3rVw_LTFglf5g1OpXxmRjZyU/pub";
$(function() {
$("#includedContent").load(publicDocURL + " #contents", function() {
$("#contents style").remove();
$('img').each(function() {
$(this).attr('src', this.src.replace(document.URL, publicDocURL));
});
});
});
</script>
</head>
<body>
<header>
<h1>My Page Heading</h1>
<h3>My Page Subheading</h3>
</header>
<main>
<div id="includedContent"/>
</main>
<footer>
<p></p>
</footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment