Improved SEO (meta tags support)
维护者通常 2 天内回复
@anikethsaha 已经在做这个了。
开始于 2020年6月23日。
评估
这个 Issue 还没有评估数据。
描述
Feature request
What problem does this feature solve?
It improves SEO of pages generated by Docsify. It makes it easier for search engines to find the relevant content, and when a user shares a link to a Docsify page, the rendered preview is more accurate (title, description and image).
Example (diff pages, same SEO 😢 ):
What does the proposed API look like?
Marp allows you to write slides using Markdown, and each file has a small header like this:
---
marp: true
title: Marp CLI example
description: Hosting Marp slide deck on the web
theme: uncover
paginate: true
---
Docsify could have something similar that would allow us to define the meta tags of each page. Example:
---
<!-- Primary Meta Tags -->
meta-title: Site title: Page title
meta-description: This is the summary that appears on search engine results or preview links
<!-- Open Graph -->
meta-og-type:
meta-og-url:
meta-og-title:
meta-og-description:
meta-og-image: https://yourdomain.com/path/to/image.jpg
<!-- Twitter -->
meta-twitter-card:
meta-twitter-url:
meta-twitter-title:
meta-twitter-description:
meta-twitter-image: https://yourdomain.com/path/to/image.jpg
---
# Page title
And the _rest_ of the page.
- I think a syntax like this would be good enough for us. I would say the first two fields are the MVP, as that works everywhere.
- Then Open Graph would be helpful, because it allows you to define an image.
- And finally, with the lowest priority/importance, the Twitter meta tags, because if Twitter can't find them it will fallback to the Open Graph tags.
How should this be implemented in your opinion?
I checked if it was possible to hack it with the current Docsify version by hardcoding HTML tags in the .md file.
<!-- markdownlint-disable MD033 -->
<!-- SEO tags -->
<title>(TITLE) (SEPARATOR) Title of this page</title>
<meta name="title" content="(TITLE) (SEPARATOR) Title of this page">
<meta name="description" content="A description that is specific to this page.">
# TITLE_HERE

It didn't work. Those tags were added inside <body> ... <article>, but we need them to exist in the <head> section.
I propose this flow:
- When Docsify reads a Markdown file, it checks if it has a header.
- If it doesn't, then everything works as is.
- If it has, it will read each key (e.g.
meta-title) and override it's value.
Example:
Docsify detects a header. One key is
meta-dummy. Docsify doesn't know how to handle this key, so it skips it. The next key ismeta-title. Docsify knows how to handle this, so it goes tohead.meta.titleand replaces the default value with the value in the file header.
Are you willing to work on this yourself?
I don't think I have enough JS and Docsify knowledge to develop this feature. But I can (beta) test it!
- 主要语言
- JavaScript
- 星标
- 31.5k
- 派生
- 5.8k
- 平均合并
- 2 天 14 小时
- 30 天内合并 PR
- 5
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
docsifyjs/docsify 的其他 Issue
-
Query parameter values are truncated at a second equals sign可能已有人在做 @xu91102 于 22 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复
-
bug Triage
难度 3/5 1-2 天 新手友好度 66/100
维护者通常 2 天内回复
-
Cached AJAX responses lose status metadata exposed through vm.route.response可能已有人在做 @xu91102 于 22 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 2 天内回复
-
In the Edge browser, the character `{docsify-updated}` is not replaced可能重新可做 @AmanUllah687 于 75 天前认领,目前没有进行中的 PR。 未关闭wait for information
难度 4/5 3-5 天 新手友好度 35/100
docsifyjs/docsify#2681 · 11 条评论 ·
维护者通常 2 天内回复
-
feature request Triage
难度 4/5 3-5 天 新手友好度 38/100
docsifyjs/docsify#2643 · 5 条评论 ·
维护者通常 2 天内回复
查看 docsifyjs/docsify 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
521xueweihan/HelloGitHub#4025 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
iib0011/omni-tools#479 ·
维护者通常 1 天内回复
-
triage
难度 2/5 1-3 小时 新手友好度 67/100
pixelfed/pixelfed-rn#508 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复