homepage_template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="keywords" content="HTML, CSS">
<meta name="description" content="My programing resume in the form of a django project built from scrarch">
<title>Resume Homepage</title>
</head>
<body>
<h1>Welcome To My Django Resume Webpage !©</h1>
<img src="main_photo.jpg" alt="Image Unable To Be Displayed">
<p </p>
<h2>Coding Projects </h2>
<a href="homepage_photos/test.html"> text!</a>
</body>
</html>
上面的 html 檔案位于名為 templates 的檔案夾中。
在模板中,我有另一個名為 homepage_photos 的檔案夾。
在 homepage_photos 我有一個名為 test.html 的 html 檔案
考慮當我查看 homepage_template.html(在我的網站上)時,我的 URL 看起來像這樣 - “mywebsite”
每當點擊鏈接時,URL 都會轉到 mywebsite/homepage_photos/test.html 而不是僅僅轉到檔案本身
旁注:我正在使用 Django
uj5u.com熱心網友回復:
您在 href 引數中犯了一個錯誤。您是說您的所有檔案都在一個檔案夾中,而所需的路徑在另一個檔案夾中。所以你應該在描述這樣的路徑之前使用 / :
<a href="/homepage_photos/test.html"> text!</a>
uj5u.com熱心網友回復:
根據檔案的組織方式,您的路徑可能不正確。如果您簡單地命名檔案(例如homepage_photos/test.html),那么它僅homepage_photos在與此 html 檔案位于同一檔案夾中時才有效。為了回傳一個檔案夾,您可以引導路徑../(例如,../homepage_photos/test.html在查找之前回傳一個檔案夾homepage_photos。最后,您還可以引導/以從原始檔案夾(index可能包含您的檔案夾或類似檔案夾)開始(請注意,/使用 Github Pages 托管時,以 with開頭效果不佳)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/365499.html
標籤:html
下一篇:型別錯誤:null不是物件(正在評估“document.getElementById(actieveLijst).style”)
