How to create simple index site for a Google-Drive folder

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

How to create simple index site for a Google-Drive folder

#1 Post by fredx181 »

How to create simple index site for a Google-Drive folder
See for example demo here:
https://on8ztwzvhh5hoqtfwumxhq-on.drv.tw/Drv2Web/ which is in fact folder "Drv2Web" and subfolders on my google-drive.
See Post #3 for a more advanced webpage by using Markdown converted to HTML.

Assuming you have a directory tree to share already on disk
First create index.html recursively, here are two options:
(there are more of course that can be found on the web).

- Perl script:
https://gist.github.com/Zverik/3555260
https://on8ztwzvhh5hoqtfwumxhq-on.drv.t ... e_index.pl
depends on perl module "HTML::Template", install with PPM: libhtml-template-perl
Make the script executable first.
Run the script from the top of your shared folder:

Code: Select all

./recursive_index.pl -r
(the -r is for recursive)

- Python script:
https://gist.github.com/glowinthedark/b ... a49fd09f49
https://on8ztwzvhh5hoqtfwumxhq-on.drv.t ... y_index.py
Make the script executable first.
Run the script from the top of your shared folder:

Code: Select all

./generate_directory_index.py
(EDIT: above will include the script on the index, if not desired, see second post for other options)

Ok, now that the html files are created, upload the whole directory tree to your google-drive
Or if it's already on google-drive, just upload the new index.html files in the different directories to google-drive (matching the same directories)
The top directory needs to be marked as "shared" otherwise it won't work.

To demonstrate I use test folder Drv2Web that I have setup on my google drive including the index.html files (created by the python script).
https://on8ztwzvhh5hoqtfwumxhq-on.drv.tw/Drv2Web/

Now, go to https://drv.tw/ (DriveToWeb) NO registration required, and choose Google-drive:
Image

Choose account (if not logged in already, you need to login first):
Image

Give DriveToWeb permission (sorry, it's in Dutch, "Toestaan" means "Allow"):
Image

Wait a while and your link(s) should show:
Image

If all works well ... congratulations !! You now have your website hosted from google-drive FOR FREE ! :)
Instead of an index website, it's also possible to host another form of static website. of course, using HTML.

Fred
Last edited by fredx181 on Wed 12 Feb 2020, 20:42, edited 8 times in total.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#2 Post by fredx181 »

Tips:

-------------------------------------------
Expanding on the info in first post about creating index.html files using generate_directory_index.py:
Use e.g:

Code: Select all

/path/to/generate_directory_index.py /path/to/shared-folder
if you don't want to include 'generate_directory_index.py' in "shared-folder"
Run

Code: Select all

/path/to/generate_directory_index.py --help
for more options (e.g. --filter can be handy).
-------------------------------------------

-------------------------------------------
It's possible to use your own domain name too, see:
https://docs-of.drv.tw/how-to/using-custom-domain-name/

For free, get one here:
https://www.freenom.com

It's doable, not easy though, anyone who needs some guidance, just ask and I'll try to help.
--------------------------------------------

Fred

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#3 Post by fredx181 »

Demo 2, simple static website using Markdown (and converted to HTML), hosted from Google Drive:

https://on8ztwzvhh5hoqtfwumxhq-on.drv.tw/Drv2WebD2/
(basically with the text from post #1)

Pet packages Markdown to HTML:
https://on8ztwzvhh5hoqtfwumxhq-on.drv.t ... to%20HTML/
See also here:
http://murga-linux.com/puppy/viewtopic. ... 36#1026936

Fred

Post Reply