# Description of Changes
This pull request introduces dynamic document meta tag management and
improves URL routing and tool metadata handling in the frontend. The
most significant changes are the addition of a custom hook to update
document meta tags (including OpenGraph tags) based on the selected
tool, enhancements to the tool selection context for better URL
synchronization, and enrichment of the `Tool` type and tool registry
with more metadata.

**Dynamic document meta management:**

* Added a new `useDocumentMeta` hook that updates the page's `<title>`,
description, and OpenGraph meta tags based on the currently selected
tool, and restores the original values on cleanup.
(`frontend/src/hooks/useDocumentMeta.ts`)
* Integrated `useDocumentMeta` into `HomePageContent` so the document's
meta tags dynamically reflect the selected tool's metadata, improving
SEO and social sharing. (`frontend/src/pages/HomePage.tsx`)
[[1]](diffhunk://#diff-85c26b21681286c20e97a26a4912f0b91812776c9d4d0c54aa541fded2565c7eR2-R8)
[[2]](diffhunk://#diff-85c26b21681286c20e97a26a4912f0b91812776c9d4d0c54aa541fded2565c7eR17)
[[3]](diffhunk://#diff-85c26b21681286c20e97a26a4912f0b91812776c9d4d0c54aa541fded2565c7eR28-R37)

**Tool metadata and context improvements:**

* Enhanced the `Tool` type and tool registry to include `title` and
`description` fields, which are now translated and used throughout the
UI and meta tags. (`frontend/src/types/tool.ts`,
`frontend/src/hooks/useToolManagement.tsx`)
[[1]](diffhunk://#diff-0b557df7bd27ac90cd2f925ddd8ef8096ea2decfaee9a5c12a94dc7a03c64bfaR46)
[[2]](diffhunk://#diff-57f8a6b3e75ecaec10ad445b01afe8fccc376af6f8ad4d693c68cf98e8863273L116-R118)
* Updated the `ToolWorkflowContext` to use the new `Tool` type for
`selectedTool`, replacing the previous `ToolConfiguration` type.
(`frontend/src/contexts/ToolWorkflowContext.tsx`)
[[1]](diffhunk://#diff-9b36e2c06dddbcfba6cb66fd0b303b7860f88ca8b562bb2534af1ab50390d385L6-R8)
[[2]](diffhunk://#diff-9b36e2c06dddbcfba6cb66fd0b303b7860f88ca8b562bb2534af1ab50390d385L72-R72)

**URL routing and synchronization:**

* Implemented logic in `ToolWorkflowContext` to synchronize the selected
tool with the browser URL, initialize tool selection from the URL on
load, and handle browser navigation (back/forward) for tool selection.
(`frontend/src/contexts/ToolWorkflowContext.tsx`)
---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.
This commit is contained in:
Anthony Stirling
2025-08-14 15:52:38 +01:00
committed by GitHub
parent 22db7bec76
commit 8149cb157c
103 changed files with 845 additions and 574 deletions
+14 -14
View File
@@ -347,7 +347,7 @@
"title": "Rothlaigh",
"desc": "Rothlaigh do PDFanna go héasca."
},
"imageToPdf": {
"imageToPDF": {
"title": "Íomhá go PDF",
"desc": "Tiontaigh íomhá (PNG, JPEG, GIF) go PDF."
},
@@ -371,7 +371,7 @@
"title": "Athrú Ceadanna",
"desc": "Athraigh ceadanna do dhoiciméad PDF"
},
"removePages": {
"pageRemover": {
"title": "Bain",
"desc": "Scrios leathanaigh nach dteastaíonn ó do dhoiciméad PDF."
},
@@ -383,7 +383,7 @@
"title": "Bain Pasfhocal",
"desc": "Bain cosaint phasfhocal ó do dhoiciméad PDF."
},
"compressPdfs": {
"compress": {
"title": "Comhbhrúigh",
"desc": "Comhbhrúigh PDFanna chun a méid comhaid a laghdú."
},
@@ -479,7 +479,7 @@
"title": "Píblíne (Ardleibhéal)",
"desc": "Rith gníomhartha iolracha ar PDFanna trí scripteanna píblíne a shainiú"
},
"add-page-numbers": {
"addPageNumbers": {
"title": "Cuir Uimhreacha Leathanaigh leis",
"desc": "Cuir uimhreacha Leathanach leis an doiciméad i suíomh socraithe"
},
@@ -487,7 +487,7 @@
"title": "Comhad PDF a athainmniú go huathoibríoch",
"desc": "Athainmníonn Auto comhad PDF bunaithe ar a cheanntásc braite"
},
"adjust-contrast": {
"adjustContrast": {
"title": "Coigeartaigh Dathanna/Codarsnacht",
"desc": "Coigeartaigh Codarsnacht, Sáithiú agus Gile PDF"
},
@@ -499,7 +499,7 @@
"title": "Leathanaigh Scoilte Uathoibríoch",
"desc": "Auto Scoilt PDF Scanta le Cód QR scoilteoir leathanach scanadh fisiciúil"
},
"sanitizePdf": {
"sanitizePDF": {
"title": "Sláintíocht",
"desc": "Bain scripteanna agus gnéithe eile ó chomhaid PDF"
},
@@ -523,11 +523,11 @@
"title": "Faigh GACH Eolas ar PDF",
"desc": "Grab aon fhaisnéis agus is féidir ar PDFs"
},
"extractPage": {
"pageExtracter": {
"title": "Sliocht leathanach(eacha)",
"desc": "Sleachta roghnaigh leathanaigh ó PDF"
},
"PdfToSinglePage": {
"pdfToSinglePage": {
"title": "PDF go leathanach mór amháin",
"desc": "Cumasc gach leathanach PDF isteach i leathanach mór amháin"
},
@@ -543,11 +543,11 @@
"title": "Athchóiriú de Láimh",
"desc": "Réiteann sé PDF bunaithe ar théacs roghnaithe, cruthanna tarraingthe agus/nó leathanaigh roghnaithe"
},
"tableExtraxt": {
"PDFToCSV": {
"title": "Ó CSV go PDF",
"desc": "Sleachta Táblaí ó PDF agus é a thiontú go CSV"
},
"autoSizeSplitPDF": {
"split-by-size-or-count": {
"title": "Auto Scoilte de réir Méid/Comhaireamh",
"desc": "Scoilt PDF amháin i ndoiciméid iolracha bunaithe ar mhéid, líon na leathanach, nó comhaireamh doiciméad"
},
@@ -563,11 +563,11 @@
"title": "Cuir Stampa go PDF",
"desc": "Cuir téacs leis nó cuir stampaí íomhá leis ag láithreacha socraithe"
},
"removeImagePdf": {
"removeImage": {
"title": "Bain íomhá",
"desc": "Bain íomhá de PDF chun méid comhaid a laghdú"
},
"splitPdfByChapters": {
"splitByChapters": {
"title": "Scoil PDF ar Chaibidlí",
"desc": "Scoilt PDF ina chomhaid iolracha bunaithe ar a struchtúr caibidle."
},
@@ -575,7 +575,7 @@
"title": "Bailíochtaigh Síniú PDF",
"desc": "Fíoraigh sínithe digiteacha agus teastais i gcáipéisí PDF"
},
"replaceColorPdf": {
"replace-color": {
"title": "Athchuir agus Inbhéartaigh Dath",
"desc": "Athchuir dath an téacs agus an chúlra i bhformáid PDF agus inbhéartaigh dath iomlán pdf chun méid comhaid a laghdú"
}
@@ -1558,4 +1558,4 @@
}
}
}
}
}