Babban matsalar da ke da alaƙa da haɗa shafukan HTML a cikin manyan fayiloli daban-daban shine cewa hanyoyin dangi da ake amfani da su don haɗa shafukan dole ne su kasance daidai. Idan hanyar dangi ba daidai ba ne, to shafin ba za a haɗa shi daidai ba kuma yana iya haifar da karyewar hanyar haɗin yanar gizo ko saƙon kuskure. Bugu da ƙari, idan tsarin babban fayil ɗin ya canza, to dole ne a sabunta duk hanyoyin haɗin gwargwadon yadda ya kamata.
<a href="../folder/page.html">Link</a>
1. Wannan layin code yana haifar da ginshiƙi na HTML, wanda ake amfani dashi don ƙirƙirar hanyar haɗi zuwa wani shafi.
2. Halin href yana ƙayyadaddun URL na shafin da mahaɗin ya kamata ya nuna, a wannan yanayin "../folder/page.html".
3. Rubutun da ke tsakanin alamar buɗewa da rufewa shine abin da za a nuna a matsayin hanyar haɗin yanar gizon, a cikin wannan yanayin "Link".
Hanyoyin Fayil na HTML
Ana amfani da hanyoyin fayil ɗin HTML don haɗi zuwa wasu shafukan yanar gizo, hotuna, da sauran fayiloli akan intanit. Ana kuma amfani da su don haɗi zuwa fayiloli a cikin gidan yanar gizon guda ɗaya. Hanyoyin fayil na HTML na iya zama cikakke ko dangi. Cikakkar hanya ita ce cikakken URL wanda ya haɗa da sunan yankin, yayin da hanyar dangi wani yanki ne URL wanda kawai ya haɗa da wurin fayil ɗin akan uwar garke. Cikakkun hanyoyin sun fi dogaro tunda koyaushe suna nuna madaidaicin wuri, yayin da hanyoyin dangi bazai yi aiki ba idan tsarin gidan yanar gizon ya canza.
Menene babban fayil na HTML
Babban fayil na HTML babban fayil ne wanda ya ƙunshi fayilolin HTML da albarkatun da ke da alaƙa kamar hotuna, CSS, da JavaScript. Ana amfani da shi don adana duk mahimman fayiloli don gidan yanar gizo ko aikace-aikacen yanar gizo. Babban fayil ɗin HTML yana ƙunshe da fayil ɗin index.html wanda ke aiki azaman wurin shiga gidan yanar gizo ko aikace-aikace. Sauran fayiloli a cikin babban fayil na iya haɗawa da ƙarin shafukan HTML, hotuna, zanen salo, rubutun, da sauran albarkatun da ake buƙata don ƙirƙirar cikakken gidan yanar gizo ko aikace-aikacen yanar gizo.
Yadda ake haɗa shafukan html a cikin manyan fayiloli iri ɗaya ko daban-daban
1. Haɗa Shafukan HTML a cikin Jaka ɗaya: Don haɗa shafukan HTML guda biyu a cikin babban fayil ɗin, yi amfani da hanyoyin dangi. Hanyoyi na dangi suna sauƙaƙa don matsar da fayiloli a kusa da su, tunda hanyoyin haɗin za su ci gaba da aiki muddin ana adana fayilolin tare.
Misali, idan kana da shafukan HTML guda biyu a cikin babban fayil mai suna "Myfolder":
index.html
game da.html
Don haɗi daga index.html zuwa about.html, yi amfani da wannan lambar:
Game da
2. Haɗa Shafukan HTML a cikin Jakunkuna daban-daban: Don haɗa shafukan HTML guda biyu a cikin manyan fayiloli daban-daban, yi amfani da cikakkun hanyoyi ko cikakkun URLs. Cikakkun hanyoyi suna ba da sauƙin kiyaye inda fayiloli suke, tunda koyaushe suna farawa daga tushen tushen gidan yanar gizon ku (misali, http://www.example.com/).
Misali, idan kana da shafukan HTML guda biyu dake a wadannan wurare:
http://www.example.com/index.html
http://www.example/folder1/about-us/index2 . html
Don haɗi daga index1 . html zuwa index2 . html, yi amfani da wannan code: