Would you like to programmatically publish some web content? Or let your users do so in the context of your Drive app?
Publishing from Drive is a simple, two-step dance: create a public folder and use a link to the root folder — the webViewLink — to publish its contents. You can refer to the Drive SDK documentation for full detail on how to work with public folders and content links, but basically the requirements are:
It’s important to emphasize the added simplicity provided by a webViewLink: using this link as a starting point, you can extend the path to any web asset in any subfolder without worrying about retrieving the exact file ID. What used to look like 0B2Gk2F2ImIBiaUkwY3JNX1JMaTg is now a recognizably cute path such as images/kittens.jpg. For the root path to the folder, we’ll display a list of files in the folder, or, if you have an index.html file in your folder we’ll load that as expected.
The ability to publish files this way opens lots of possibilities for Drive app developers. Writing a blogging tool, creating a process to publish updates to shared docs, outputting images in a folder in a gallery page — any Drive use case that involves presenting a file in a browser can benefit from site publishing. We look forward to seeing what you create, and we’re happy to answer your questions on Stack Overflow.
We use Google Sites. :)
Is there a way to do this entirely from the drive.google.com UI? How do I get the webViewLink?
Same question as Peter. How do I determine the webViewLink accessing Google Drive via the browser?If I create a document with the name index.html via the browser UI will this be recognised as the home page?
Hi Michael,Yes it will! In the link to our (admittedly unspectacular) example site, the longish string actually identifies a folder, not a file. When a browser hits a public folder that way, Drive serves up index.html if it exists, or a simple contents page otherwise.To the question you and Peter both pose: I'll check further, but I believe there is no clean way to do that currently with the UI. Manually, you can inspect folder and file IDs in the URLs and work that way -- but that's probably not what you want. However, this feature is practically begging someone to develop a Drive app that lets users build simple sites, managing the webViewLinks for them in nice GUI . . . Thanks for the comments!
Yeah; I searched for such a Drive App, but I guess still early days. Thanks!
Would it be possible to link to this kind of content from, say, a wordpress site?
Wow, most awaited feature. Looks like web hosting companies will have to shut their shops.I just created a test page and uploaded it to a public folder. See here what I got.https://googledrive.com/host/0B2MdbzABFW_uTE9kU21yMnl6bUU/
why not 'simply' use gSites?anybody out there who could document PROs and CONs?
And yet there is no path to editing html files in Google Drive, at least not in the iPad App. Not even an "unknown file type - edit as text?" option.
This comment has been removed by the author.
Can a custom domain be used to make it prettier?
Woah, this sounds pretty powerful stuff. Google is basically giving web developers the ability to setup a free CDN using GDrive.
Its nt rocket science to figure out your public drive URL. Just create a folder in drive, then go to drive.google.com and share the folder ~ making it public, it will give you a URL like:https://docs.google.com/folder/d/999-GlkadL3zcVRGSTFLRFZBQWM/editits pretty easy to see the ID of the folder there. Then you take that id and turn it into this:https://googledrive.com/host/999-GlkadL3zcVRGSTFLRFZBQWM/But I agree... if a folder is public, Google should make it easier and just provide both URLs in the share popup page for less copy and paste ;)
Wow, amateur very interested is there any video or website for step by step instructions to set up a website?
would it be free ? no adds?Can I forward my domain?
@Triune, I tried that; doesn't serve the HTML even though I have an index.html, nor does it allow me to access other resources under that path. I just get a generic UI for the public folder and 404s for anything below that. Thus I assumed the webViewLink ID is different from the normal ID.But now I notice that the public folder UI is not showing the files either, so problem seems to be that they are public GDocs but somehow not public from the Drive folder?
Okay, problem was that I left conversion to GDocs format on when I uploaded the test doc. Sorry about that.Next question: how will API keys be handled? Doesn't seem like the old activation by domain setup works for this situation...
Sorry again; I see I am able to put more than just the domain, so it appears that whitelisting an API key with the whole URL up to the end of the ID will work. Thanks!
@David, NeutronDrive seems like a pretty nice HTML editor for Drive on Chrome. Maybe see if there is an iOS version?
If your looking for this as an end user feature checkout my app:Neutron DriveIt lets you edit code from Google Drive and I just added support for this today.
Will it support css in the future??
Is Google Drive WordPress compatible, i.e. does it support:- PHP 5.2.4 or greater- MySQL 5.0 or greater- The mod_rewrite Apache moduleI suspect not?Thanks
Now there is an URL shortening service GDriv.es providing vanity URLs specially for Google Drive hosting.
It's terrific to see a good discussion like this growing out of a blog post. Also very cool to see a free URL shortener appearing so quickly!I can try to speak to the Sites vs. Drive question a little. It seems to me that Sites is very friendly to users who prefer a GUI-based way to edit HTML pages. Sites gives such folks precooked widgets to help create common page elements, and lets you easily insert nifty things like maps and Apps Script Gadgets. However, if you write HTML and know what you want your pages to look like (and yes, we do indeed support CSS!) then the Drive option might work better for you. If you have existing assets, you can drop them into a public folder very easily, with full visibility into the folder hierarchy. And as Paul pointed out, it's easy to install an editor like Neutron Drive and edit your files.
Well, static pages... not to be rude or something like that, but we are in 2012, static pages have no space in this year. You can even create a real hosting business, who in the world world not want to host his entire site in Google service?!Sorry for my English.Greetings
@Mori: That's where GDriv.es comes. You no longer have to deal with "funky" URLs, but your custom aliases. And if you own a domain, you can set a domain redirection using mod_rewrite or frames.
Eric, can you answer my query about Wordpress compatability?Many Thanks
This is a nice POC but far from easy to use or flexible. Why does googledrive.com only support HTTPS for example? This prevents using any resources via HTTP. It seems meaningless to enforce HTTPS here.
Another great feature of Gdrive!
I'm enjoying google drive hosting and now especially gdriv.es. But, I can't get my countdown clock to work. I generated one from countingdownto.com.
This only works for Google Apps domains that allow sharing to Public. If you restrict document sharing to the domain (as many K12 schools do) this does not work.It would be nice if this worked the same way as other file sharing for domain restrictions
Of course there is always goo.gl as well, remember.
This comment has been removed by a blog administrator.
Will/does Google Drive Site Publishing support domain mapping, as Google Sites does? Pretty please?
As I understand it's not possible to use SSI (Server Side Include)...It seems it's not possible to use relative path as: "../image.jpg" as well.I I'm wrong let me know, otherwise this are big limitations :(
Hi Eric,Good info ! But what if I just want to see one htm file uploaded to GDriver ?
I tried this, but can't get it to work on my Google Drive that's part of Apps for Education. Does the domain name go in there someplace? I tried drive.google.com/host/ and drive.google.com//host and just drive.google.com/host/... as shown, but I'm not able to link.The folder and file are definitely publically visible. Thanks for any insight!
It's possible to host a site in google drive with a custom domain, with http://gweb.io/
This is great! But how can I deny directory listing as explained here:http://stackoverflow.com/questions/19395306/google-drive-web-hosting-deny-directory-listing
Here's a free HTML Editor for Google Drive: HTML Editey.