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": "使用物理扫描页面分割器 QR 代码自动拆分扫描的 PDF"
|
||||
},
|
||||
"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": "自动根据大小/数目拆分 PDF",
|
||||
"desc": "将单个 PDF 拆分为多个文档,基于大小、页数或文档数"
|
||||
},
|
||||
@@ -563,11 +563,11 @@
|
||||
"title": "添加图章",
|
||||
"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