Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin-sitemap): add sitemap plugin (close #337) #277

Closed
wants to merge 4 commits into from
Closed

feat(plugin-sitemap): add sitemap plugin (close #337) #277

wants to merge 4 commits into from

Conversation

Mister-Hope
Copy link
Member

@Mister-Hope Mister-Hope commented Jul 10, 2021

Close #337

@Mister-Hope
Copy link
Member Author

Addtional: CI failed because of coverage, but since this plugin is deeply coupled with vuepress plugin api, it's hard to add some tests.

Copy link
Member

@meteorlxy meteorlxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow the same file structure as other plugins, i.e. only use node/index.ts to import/export things, and use a node/sitemapPlugin.ts file to declare the plugin

packages/@vuepress/plugin-sitemap/src/node/index.ts Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
packages/@vuepress/plugin-sitemap/package.json Outdated Show resolved Hide resolved
@Mister-Hope
Copy link
Member Author

Got it. i will update these days!

@meteorlxy meteorlxy changed the title feat: add sitemap plugin Aug 3, 2021
@ramesh-dada
Copy link

@meteorlxy @Mister-Hope THANK You so much for doing great work is their any estimated release date that when this plugin will be released ?

@Mister-Hope
Copy link
Member Author

Mister-Hope commented Aug 5, 2021

I am finishing all the changes, except I remain zh jsdocs in SitemapOptions.

IMO, as we are providing both chinese and english docs, it's reasonable to keep both the languages in the final options provided to users to make sure they get full hints.

packages/@vuepress/plugin-sitemap/package.json Outdated Show resolved Hide resolved
packages/@vuepress/plugin-sitemap/package.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
@meteorlxy
Copy link
Member

IMO, as we are providing both chinese and english docs, it's reasonable to keep both the languages in the final options provided to users to make sure they get full hints.

Remove them, or we need to add translations to all other comments.

@maodou38
Copy link

maodou38 commented Aug 6, 2021

it's happy to know that we will support support sitemap recently.And also appreciate @Mister-Hope ‘s sitemap plugin.
i will use your plugin until the official release version online

@ramesh-dada
Copy link

@Mister-Hope Before you merge this can you please take a look at this also #353

@Mister-Hope
Copy link
Member Author

I would prefer not to support any of the 2 fr in #353. For my personal reason, see #353 (comment)

If you have different ideas and think any of them should be supported, just leave a message.

yarn.lock Outdated Show resolved Hide resolved
docs/zh/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
@maodou38
Copy link

why the pull request bog down?

@Mister-Hope
Copy link
Member Author

why the pull request bog down?

I am a postgraduate student, just kind of busy in real life.

@liziwl
Copy link

liziwl commented Oct 5, 2021

Any progress on the feature of sitemap?

@KnorpelSenf
Copy link
Contributor

What are the chances that this lands in the 2.0 release?

@jrcharles
Copy link

Any update here?

@Mister-Hope
Copy link
Member Author

I will finish it once my winter vacation begins, just busy being a postgraduate student studying quantum physics

@Mister-Hope
Copy link
Member Author

@meteorlxy Should be ready

docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
packages/@vuepress/plugin-sitemap/tsconfig.build.json Outdated Show resolved Hide resolved
@Mister-Hope
Copy link
Member Author

Some explaination:

  • A lot of plugin option has been renamed
  • modifyTimeGetter is better with a Page arg, see plugin docs example
  • A short description of sitemap is added.
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
docs/reference/plugin/sitemap.md Outdated Show resolved Hide resolved
@Zhengqbbb
Copy link

I will change the logic, only when base is / and user has a robot.txt in public folder, the plugin will try to add sitemap url to it. This should be better.

I also think this is the right design, whatever this is a sitemap plugin.
But robot.txt is spider friendly for sites that don't submit sitemaps. For documentation, it would be better to mention that robot.txt needs to be added to the publish folder.

@Zhengqbbb
Copy link

And for 1, you should set priority in frontmatter.sitemap.priority and it's injected in the speard operator I think.
Is this option problematic to you?

  • But you can see that it is not mentioned in the English document, but mentioned in the one asked in Chinese.
  • I think the significance of this option item is that for md files that do not declare formatter on normal pages, this is a unified source of priority. After all, everyone is not very willing to think about the priority of this page.
@Mister-Hope
Copy link
Member Author

Mister-Hope commented Jan 31, 2022

I also think this is the right design, whatever this is a sitemap plugin.
But robot.txt is spider friendly for sites that don't submit sitemaps. For documentation, it would be better to mention that robot.txt needs to be added to the publish folder.

The missing option in docs is added.

@Mister-Hope
Copy link
Member Author

And for 1, you should set priority in frontmatter.sitemap.priority and it's injected in the speard operator I think.
Is this option problematic to you?

  • But you can see that it is not mentioned in the English document, but mentioned in the one asked in Chinese.
  • I think the significance of this option item is that for md files that do not declare formatter on normal pages, this is a unified source of priority. After all, everyone is not very willing to think about the priority of this page.

A description is added

@Mister-Hope
Copy link
Member Author

@meteorlxy Could you have another check?

@Jelledb
Copy link

Jelledb commented Feb 9, 2022

Looking forward to the sitemap plugin!

@JohannesRudolph
Copy link

I can confirm the sitemap plugin is working fine, pulled the code from the PR in as a "vendored" dependency and it works great for our site.

@Mister-Hope
Copy link
Member Author

Mister-Hope commented Mar 3, 2022

@meteorlxy 👀大哥有空审一下吧,不要摸鱼了🤣

(For the rest, free to ignore this, I can't catch up a translation in English for 摸鱼)

@JohannesRudolph
Copy link

One feedback, I'd like to have the option to set the changefreq option to null/undefined so that it's not part of the sitemap. Since we already have lastmod this is going to be fine for most sites and sends less confusing signals to search engine crawlers.

@hustcer
Copy link

hustcer commented May 4, 2022

It's really a long time to wait

@Mister-Hope
Copy link
Member Author

You can use vuepress-plugin-sitemap2

@jrappen
Copy link

jrappen commented Sep 4, 2022

@jrappen
Copy link

jrappen commented Sep 4, 2022

I was asking about this pull request, not about the other plugin.

@Mister-Hope
Copy link
Member Author

That plugin is published by me as the same with this pr.

@jrappen
Copy link

jrappen commented Sep 5, 2022

Are you going to rebase and fix conflicts, as this is the last item on the roadmap?


::: warning Together with robots.txt

Sitemap is basicly used by search engines, when using this plugin, you'd better ensure that you have a valid `rotbot.txt` in the `.vuepress/public` folder to allow search engines spiders to visit your site. A simplest robots.txt is as follows (allow all search engines to access all paths)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be robots.txt


::: warning 同步配置 robots.txt

由于 Sitemap 面向搜索引擎,配合此插件使用时,你最好保证你在 `.vuepress/public` 文件夹下放置了有效的 `rotbot.txt`,以允许搜索引擎收录。一个最简单的 robots.txt 如下(允许所有搜索引擎访问所有路径)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be robots.txt

@taozuhong
Copy link

taozuhong commented Dec 9, 2022

能不能早点合入并发布稳定版本?要不 VitePress 都出来了,它的价值空间就会被严重挤压,这么多努力就白费了。
Machine translate:
Could merge and release a stable version as soon as quickly? Otherwise, VitePress will come out, its value space will be severely squeezed, and so much effort will be in vain.

@meteorlxy
Copy link
Member

@taozuhong You can take a look at vuejs/vitepress#548

VitePress might be VuePress 3 as a decision of Vue.js Team. So VuePress 2 has already been in an awkward position. That's why the stable version delayed a lot.

@Mister-Hope
Copy link
Member Author

I am updating vuepress-plugin-sitemap2 with every vp2 version, you are free to use that.

@taozuhong
Copy link

@taozuhong You can take a look at vuejs/vitepress#548

VitePress might be VuePress 3 as a decision of Vue.js Team. So VuePress 2 has already been in an awkward position. That's why the stable version delayed a lot.

Nice to see it, hope the plugins Api become more stable than last, make the plugin ecosystem release more power.

@Mister-Hope
Copy link
Member Author

Closing, this will be maintained speratedly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet