mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-09-14 12:42:08 +02:00
SEO init (#4197)
# 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:
@@ -347,7 +347,7 @@
|
||||
"title": "旋轉",
|
||||
"desc": "輕鬆旋轉您的 PDF。"
|
||||
},
|
||||
"imageToPdf": {
|
||||
"imageToPDF": {
|
||||
"title": "圖片轉 PDF",
|
||||
"desc": "將圖片(PNG、JPEG、GIF)轉換為 PDF。"
|
||||
},
|
||||
@@ -371,7 +371,7 @@
|
||||
"title": "修改權限",
|
||||
"desc": "修改您的 PDF 檔案權限"
|
||||
},
|
||||
"removePages": {
|
||||
"pageRemover": {
|
||||
"title": "移除",
|
||||
"desc": "從您的 PDF 檔案中刪除不需要的頁面。"
|
||||
},
|
||||
@@ -383,7 +383,7 @@
|
||||
"title": "移除密碼",
|
||||
"desc": "從您的 PDF 檔案中移除密碼保護。"
|
||||
},
|
||||
"compressPdfs": {
|
||||
"compress": {
|
||||
"title": "壓縮",
|
||||
"desc": "壓縮 PDF 以減少其檔案大小。"
|
||||
},
|
||||
@@ -479,7 +479,7 @@
|
||||
"title": "管道(進階)",
|
||||
"desc": "透過定義管道指令碼在 PDF 上執行多個操作"
|
||||
},
|
||||
"add-page-numbers": {
|
||||
"addPageNumbers": {
|
||||
"title": "新增頁碼",
|
||||
"desc": "在文件的設定位置新增頁碼"
|
||||
},
|
||||
@@ -487,7 +487,7 @@
|
||||
"title": "自動重新命名 PDF 檔案",
|
||||
"desc": "根據其偵測到的標頭自動重新命名 PDF 檔案"
|
||||
},
|
||||
"adjust-contrast": {
|
||||
"adjustContrast": {
|
||||
"title": "調整顏色/對比度",
|
||||
"desc": "調整 PDF 的對比度、飽和度和亮度"
|
||||
},
|
||||
@@ -499,7 +499,7 @@
|
||||
"title": "自動分割頁面",
|
||||
"desc": "自動分割掃描的 PDF,使用實體掃描頁面分割器 QR Code"
|
||||
},
|
||||
"sanitizePdf": {
|
||||
"sanitizePDF": {
|
||||
"title": "清理",
|
||||
"desc": "從 PDF 檔案中移除指令碼和其他元素"
|
||||
},
|
||||
@@ -523,11 +523,11 @@
|
||||
"title": "取得 PDF 的所有資訊",
|
||||
"desc": "取得 PDF 的所有可能資訊"
|
||||
},
|
||||
"extractPage": {
|
||||
"pageExtracter": {
|
||||
"title": "提取多個頁面",
|
||||
"desc": "從 PDF 中提取選定的頁面"
|
||||
},
|
||||
"PdfToSinglePage": {
|
||||
"pdfToSinglePage": {
|
||||
"title": "PDF 轉單一大頁面",
|
||||
"desc": "將所有 PDF 頁面合併為一個大的單一頁面"
|
||||
},
|
||||
@@ -543,11 +543,11 @@
|
||||
"title": "手動塗黑",
|
||||
"desc": "依據選取的文字、繪製的形狀和選取的頁面塗黑 PDF"
|
||||
},
|
||||
"tableExtraxt": {
|
||||
"PDFToCSV": {
|
||||
"title": "PDF 轉 CSV",
|
||||
"desc": "從 PDF 中提取表格並將其轉換為 CSV"
|
||||
},
|
||||
"autoSizeSplitPDF": {
|
||||
"split-by-size-or-count": {
|
||||
"title": "根據大小/數量自動分割",
|
||||
"desc": "根據大小、頁數或文件數將單一 PDF 分割為多個文件"
|
||||
},
|
||||
@@ -563,11 +563,11 @@
|
||||
"title": "將圖章新增到 PDF",
|
||||
"desc": "在設定位置新增文字或新增影像圖章"
|
||||
},
|
||||
"removeImagePdf": {
|
||||
"removeImage": {
|
||||
"title": "移除圖片",
|
||||
"desc": "從 PDF 中移除圖片以減少檔案大小"
|
||||
},
|
||||
"splitPdfByChapters": {
|
||||
"splitByChapters": {
|
||||
"title": "依章節分割 PDF",
|
||||
"desc": "根據 PDF 的章節結構將其分割成多個檔案。"
|
||||
},
|
||||
@@ -575,7 +575,7 @@
|
||||
"title": "驗證 PDF 簽章",
|
||||
"desc": "驗證 PDF 文件中的數位簽章與憑證"
|
||||
},
|
||||
"replaceColorPdf": {
|
||||
"replace-color": {
|
||||
"title": "取代與反轉顏色",
|
||||
"desc": "取代 PDF 中文字和背景的顏色,並反轉整個 PDF 的顏色以減少檔案大小"
|
||||
}
|
||||
@@ -1558,4 +1558,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user