Skip to content

Commit

Permalink
set canonical value for fieldnotes
Browse files Browse the repository at this point in the history
  • Loading branch information
danhartley committed May 18, 2024
1 parent 6f2fc03 commit 0141f29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/read-fieldnotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<link rel="stylesheet" href="./styles.css">
<link rel="icon" href="./favicon.ico" />
<link href="./print.css" media="print" rel="stylesheet" />
<link rel="canonical" href="https://ifieldnotes.org/" />
<script src="./read-fieldnotes.js" type="module"></script>
</head>

Expand Down
1 change: 1 addition & 0 deletions public/read-inaturalist.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>Search and filter iNaturalist observations</title>
<link rel="stylesheet" href="./styles.css">
<link rel="icon" href="./favicon.ico" />
<link rel="canonical" href="https://ifieldnotes.org/inaturalist" />
<script src="./read-inaturalist.js" type="module"></script>
</head>

Expand Down
4 changes: 4 additions & 0 deletions public/ui-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,10 @@ export const updateHistoryAndTitle = ({window, slug, title}) => {
if(slug) {
window.history.pushState({}, title, `/${slug}`)
window.document.title = `iFieldnotes | ${title}`

// Add canonical link to self
window.document.querySelector("link[rel='canonical']")
.setAttribute('href', `https://ifieldnotes.org/${slug}`)
} else {
window.history.pushState({}, title, '/')
}
Expand Down
1 change: 1 addition & 0 deletions public/write-fieldnotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>Write fieldnotes based on iNaturalist observations</title>
<link rel="stylesheet" href="./styles.css">
<link rel="icon" href="./favicon.ico" />
<link rel="canonical" href="https://ifieldnotes.org/write" />
<script type="module" src="./write-fieldnotes.js" type="module"></script>
</head>

Expand Down

0 comments on commit 0141f29

Please sign in to comment.