Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Mehrad Rousta
Mehrad Rousta

Posted on

     

Have an offline version of a website

Originally posted atmy blog.

At the beginning of 2017,Shamim,Maryam, andParastoo met each other at the university, when they were passing master of tourism management course. Years of friendship and traveling made them closer to each other. And one day they decided to share this wonderful feeling with others. the result wasIrandestina group. Irandestina was the space to experience the good filling of traveling. friendly, creative and adventurous trips with respect to the environment and the lives of host communities. later they've also pivoted to accessible tourism but with the fall of Iran economy now 2 of them are migrated and Irandestina stopped here.

then around July of 2019 Parastoo asked me if I can find a way to keep Irandestina website content without the need to pay for hosting. and I said "Yes!". my plan was to download the whole website and put it overGithub/Gitlab Pages for free and point the domain to there too.

I remembered as a child there was some softwares on windows OS to do that. so we had a Dial-up connection and sometimes I would download all of a website so I won't need Internet access to browse it. but now I was on Linux and knew there must be an easier way to do this.

And it is! it's calledWGET!

$wget\--recursive\--no-clobber\--page-requisites\--html-extension\--convert-links\--domains irandestina.com\--no-parent\         www.irandestina.com

all you I had to do was this.

The options are:

  • --recursive: the most important flag, download sub URLs in given address.
  • --domains irandestina.com: don't follow links outside irandestina.com.
  • --no-parent: don't follow the links outside of provided URL, can b used to download only one sub URL.
  • --page-requisites: get all the elements (images, CSS, JS and others) of the page.
  • --html-extension: save files with the .html extension.
  • --convert-links: convert HTML links to local version so site is navigable offline.
  • --no-clobber: don't overwrite the already downloaded files (used when the download is interrupted and resumed).

for more options you can check outit's manual page. alsoread more at thegeekstuff.com

so now let's ship this static website we just downloaded. I hope you know how to work with Git. create a new repository, go inside the downloaded directory and do this:

  1. git init
  2. git add *
  3. git commit -m "add static content"
  4. git remote add origin git@github.com:m[REPOSITORY ADDRESS]
  5. git push -u origin master

great! now open the repository setting and make themaster branch the Source for Github Pages. you can also add acname file to the repo so you can have your custom domain.read more at Github Help.

image-20200402172636792

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp