Hey guys, I just created my first website in VS code , how do I publish it to be public?

My website is in VS code and I have multiple html files linked within it.

To mount your site on the web you need a domain, and a host server. If you have neither, then you may have to explore other options such as github (about which I know nothing).

Thank you, Is there any tutorial that you could recommend me that could teach me how to do so? I´m a beginner, sorry

Find a domain registrar in your own country and pay the fee to register a domain for the longest available period (usually up to three years). Once you have a domain then find a host provider in your country, and set up an account.

Hosting providers may bill quarterly, bi-annually or annually. A basic one domain account usually runs from 5 to 10 dollars per month. If you have a credit card or PayPal account payment is generally seamless; you’ll likely get a notice about seven days in advance that a charge is going to be applied.

Use your permanent e-mail address (gmail, etc.) for communicating with your host, not an email address on your domain. That way if your account is ever suspended you don’t lose access to your mail connection with the host.

If the registrar offers privacy protection with your domain (perhaps for a small additional fee) then buy it. It only costs about 15 to 20 dollars a year to keep a domain.

You should know that we do not own our domain, only rent it. That’s why we should take the longest term available. It is necessary for us to know when to renew our domain, or risk losing our right to it.

Be sure to only read notices from your actual Registrar, and not open or read any mail from other domain phishing schemes. Mark them as spam if you get any.

When you get the first email from the Registrar, be sure to mark it, and the sender as Important. In most email clients, we’ll spot our own Registrar by the star by their name, and know for sure that a phishing scam it is not.

Perhaps this is confusing, and one can understand why. Due diligence is our responsibility, not the Registrar, nor the host provider so you will need to read up on all the ways your domain can be exploited, hacked, spoofed, and otherwise misused, more often than not without your knowing.

Search for ICANN and read up all the literature on their site to get a basic understanding of how the domain name system works.

Search for ‘secure my site’ and read up on all the above mentioned threats. I don’t mean to foment fear as much as just stress the importance of being informed and vigilant.

If you can afford it, hire a service to baby-sit your site and alert you to issues (broken links being most common) or suspicious activity. They are likely to be informed of all the typical bots crawling the web, and can identify the friendly ones, and question the nefarious ones. After a year or so you should be informed and aware enough to take over those responsibilities (or not).

All the cautions aside, you will at some point in time have,

  • a domain and a TLD (example.com)
  • a host provider
  • access to your site by secure FTP or otherwise

Try to think of about 50 different possible names, keeping them as short as possible. The Registrar will have a search engine that can check anything we enter and report back whether that domain is available, and on what TLDs.

example  =>  domain
.com     =>  Top Level Domain

Your hostname will be registered as the combination. There can still be others using the same domain on other TLDs. Something to consider when deciding on your domain name. Search for those that have the most TLDs available so there is no clash with other sites.

Registration is an important process and one we want to get right, from the start. The reason I suggest registering your own domain is so you can transfer from one host to another without restriction. Many hosts provide a domain in the account, but that domain cannot be transferred to another host, nor transferred to another individual. You can sell your domain if you control it.

The next step will be propagation of your namespace throughout the DNS so your site is reachable. This process is handled by your host, and may take anywhere from a few hours to a day or so. When you can reach your site in a browser, you’ll know that it’s up and running.

 www.example.com

should open up a home page installed by your host. You want to replace that page quickly, before search engines pick up the signal you just sent by accessing the domain in your browser. The time waiting for propagation is best spent getting the home page and supporting resources (scripts, images, styles) up on the server, and let your home page be the one first seen when that signal is sent.

There you have it. Certainly not the for dummies version, but gleanings from which to harvest. Hopefully we’ve given you a plan of attack.


Addendum

While it is possible to drag and drop an entire site with a smart client, once the site is up it is advisable to disconnect the client and reconnect with your editor. Now access the site and download each page to your editor, one at a time and do a thorough audit. The largest concern is local URLs. They should all be relative to the site root, or their containing folder, not the domain.

'/index.html'

is your site root; and, given how servers default to that page,

'/'

is the site root, regardless whether we name our home page,

 index.htm
 index.html
 index.php
 index.asp
 index. ....

 home.htm
 home.html
 home.php
 ...

Links to your site should only ever be to the domain name, not including the page (resource) name.

http://www.example.com/

Then it doesn’t matter what name is given to your home page.

Of course, if we have a specific page we want to share, then we would use the full resource name, as much as necessary. I like to send links to folders and let the server detect the likely landing page.

 http://www.example.com/photos/birds/

That link will find the landing page of the ‘birds’ folder.

Bottom line, take this first mount process slowly, and get it right, from the start. Less is more, at this point while you sort out all the resource paths within the site. The home page is the most important page of a new domain, so if need be, focus all your attention on that page. Deploy all links back onto the page while you sort this out.

 <a href="#">About</a>

Don’t leave it like that for too long (a few days) but better to not have another page breaking while you work on this one. When the About page conforms, then install the URL in the navigation.

 <li><a href="/about.html">About</a></li>

Organize your site in ways a search engine will likely expect. images is a folder name they might instantly search for. If you have one, they’ll eat it up. This can help get your images in the index quicker than if the crawlers have to start digging.

A picture that we want to have indexed…

<img src="/images/index_this_picture_that_I_own.png" alt="A picture I took myself of something that has meaning to this page or domain" width="100%">

Any pictures you do not want indexed would be stashed away in a CSS folder.

body {
    background-image: url(skin/my_select_bg_image.png)
}

The above skin folder is inside the css folder. Crawlers are less likely to dig around in here, and there are ways we can keep them out, for real. (Not a concern, just now.)

2 Likes

considering github might be worth it though, given its free.

Here are some guides to help you:

https://gist.github.com/TylerFisher/6127328
https://discuss.codecademy.com/t/beginner-guide-to-hosting-your-site-with-github-pages/7501

1 Like