Testing Website Speed
After deploying our static blog site, we can use the testing tool provided by Google to detect the performance of the website: https://pagespeed.web.dev/
The test result is as follows:
![Pagespeed Pagespeed](/posts/accelerate-and-protect-your-site-with-cloudflare/images/pagespeed_hu2811704973419502587.jpg)
Common optimization directions include enabling compression, compressing and merging JS/CSS resources, and postponing JS loading. Overall, the performance of the static site generated by Hugo is quite good.
Search Engine Inclusion
After our blog site goes online, if we want it to be searchable, we can submit it to search engines. In the long term, we can also do SEO (Search Engine Optimization).
To verify if our website has been indexed by search engines, we can search for site:tomo.dev
in the search engine.
![Google Search Google Search](/posts/accelerate-and-protect-your-site-with-cloudflare/images/search-google_hu6266242293859961901.jpg)
![Baidu Search Baidu Search](/posts/accelerate-and-protect-your-site-with-cloudflare/images/search-baidu_hu7702565097542431366.jpg)
As you can see, our site has not been indexed by search engines. At this point, we can manually submit the site to the search engine for indexing.
For Google, you can submit through Search Console .
![Google Search Console Google Search Console](/posts/accelerate-and-protect-your-site-with-cloudflare/images/search-google-console_hu9804408844997606507.jpg)
For Baidu, you can submit links through the Baidu Resource Platform .
![Baidu Link Submission Baidu Link Submission](/posts/accelerate-and-protect-your-site-with-cloudflare/images/search-baidu-linksubmit_hu1840018085490020939.jpg)
Generally, after submission, it will be indexed by search engines within 1-2 days. Searching for site:tomo.dev
again will show the search results:
![Google Search Post Submit Google Search Post Submit](/posts/accelerate-and-protect-your-site-with-cloudflare/images/search-google-post-submit_hu15452533146529869555.jpg)
Cloudflare
Cloudflare offers a free plan that can basically meet the daily needs of most individual users. To use Cloudflare’s CDN service, we need to migrate our domain name resolution to Cloudflare.
Register a Cloudflare account, add a site, and choose the Free plan.
Get the Cloudflare name server address.
Configure the name server according to the domain name registration site. The following figure shows the configuration for Google Domain.
After the name server migration, we can configure DNS resolution in Cloudflare. Be sure to select the Proxied mode.
Confirm the SSL/TLS configuration. Since our site itself has Caddyserver providing HTTPS, we can choose the Full mode here.
At this point, our site is cached by Cloudflare, which will speed up access for users from all over the world. The default cache policy of Cloudflare is 4 hours, which can be configured through Browser Cache TTL in the Caching menu.