简体   繁体   English

Wordpress 永久链接结构问题

[英]Wordpress Permalink Structure Issues

Hoping someone can advise / help with this.希望有人可以为此提供建议/帮助。

I've tried using the standard wordpress permalinks settings, as well as plugins to figure this out, but as soon as I think I'm getting somewhere, something else breaks.我已经尝试使用标准的 wordpress 永久链接设置以及插件来解决这个问题,但是一旦我认为我到了某个地方,就会出现其他问题。

The current set-up:目前的设置:

Blog page is called insights:博客页面称为见解:
/insights/ /见解/

Current setup in wordpress permalinks: wordpress 中的当前设置永久链接:
/insights/%category%/%postname%/ /insights/%category%/%postname%/

Category and tag base are empty.类别和标签库为空。

Categories:分类:

  • All (all posts have this tag)全部(所有帖子都有这个标签)
  • Case Studies实例探究
  • Articles文章
  • News消息

And numerous tags eg agile, analytics, etc以及众多标签,例如敏捷、分析等

Currently this is producing:目前正在生产:

insights/all/postname见解/全部/帖子名

Category listing pages:类别列表页面:
insights/all见解/全部
insights/case-studies见解/案例研究
etc etc等等等等

Tag listing pages:标签列表页面:
insights/tag/agile见解/标签/敏捷
insights/tag/analytics见解/标签/分析
etc etc等等等等

Ideally we want:理想情况下,我们想要:

insights/case-studies/postname见解/案例研究/帖子名称
insights/articles/postname见解/文章/帖子名
insights/news/postname见解/新闻/帖子名
etc etc等等等等

Category list pages are as we want them:类别列表页面是我们想要的:
insights/all见解/全部
insights/articles见解/文章
insights/case-studies见解/案例研究
etc etc等等等等

However, currently the pagination on these category list pages is broken (404).但是,目前这些类别列表页面上的分页已损坏(404)。

Tag list pages:标签列表页面:
insights/agile洞察力/敏捷
insights/analytics见解/分析
etc etc等等等等

Adding "."添加“。” to the tag base breaks the tag links on the site.到标签库会破坏网站上的标签链接。 What confuses me is the category base is also empty, but the url for categories isn't "insights/category/all" etc.让我感到困惑的是类别库也是空的,但是类别的 url 不是“见解/类别/全部”等。

I understand as wordpress looks for the first category, to stop all the posts showing as "/insights/all/postname" we should have all as a parent category, with the other categories as children.我理解 wordpress 寻找第一个类别,停止所有显示为“/insights/all/postname”的帖子,我们应该将所有帖子都作为父类别,其他类别作为子类别。 However this throws up other issues with broken links and a url structure of "/insights/all/articles/" etc.但是,这会引发其他问题,例如链接断开和“/insights/all/articles/”等的 url 结构等。

Could there be a specific theme settings that are throwing this out too?是否有特定的主题设置也将其丢弃? If so it's deep in the php file/s.如果是这样,它就在 php 文件中。

Any advice you can shed would be greatly appreciated!您可以提出的任何建议将不胜感激!

Many thanks非常感谢

UPDATE: The category base was being removed by a plugin an SEO guy had implemented (Yoast).更新:类别库被 SEO 人员实施的插件(Yoast)删除。 After removing this the pagination worked on:删除后,分页工作:
insights/category/all见解/类别/全部
etc ETC

Adding in either "."添加任何一个“。” or "insights" to the category base, fixed the url to how we wanted it (ignoring the category / child category issue), and kept the pagination working, however this broke all the tag links - even though nothing is entered into the tag base input?!或对类别库的“见解”,将 url 修复为我们想要的方式(忽略类别/子类别问题),并保持分页正常工作,但这破坏了所有标签链接 - 即使没有输入标签库输入?!

If you want to change the whole URL generation scheme for your website, then go to the Settings » Permalinks page in your WordPress admin dashboard.如果您想为您的网站更改整个 URL 生成方案,然后将 go 更改为 WordPress 管理仪表板中的设置»永久链接页面。

Select permalink structure Select 永久链接结构

Here, you can select a URL structure for your individual posts.在这里,您可以为您的个人帖子 select 和 URL 结构。 You can also use the tags shown on the screen to create a custom structure for your WordPress URLs.您还可以使用屏幕上显示的标签为您的 WordPress URL 创建自定义结构。

Don't forget to click on the 'Save Changes' button to store your changes.不要忘记单击“保存更改”按钮来存储您的更改。

We recommend using a URL structure that includes the post name in the URL.我们建议使用在 URL 中包含帖子名称的 URL 结构。 This makes your URLs more user-friendly and can improve your WordPress SEO.这使您的 URL 更加用户友好,并且可以改进您的 WordPress SEO。

Note: You should change to SEO-friendly permalinks for all new WordPress blogs and websites.注意:您应该将所有新的 WordPress 博客和网站更改为对 SEO 友好的永久链接。

However, if you have an existing website that's already getting traffic from search engines, then changing permalinks can affect your SEO rankings.但是,如果您有一个已经从搜索引擎获得流量的现有网站,那么更改永久链接可能会影响您的 SEO 排名。 How to Change the Category and Tag URL Prefix in WordPress如何更改 WordPress 中的类别和标签 URL 前缀

By default, WordPress uses /category/ as the base for your category URLs and /tag/ for the tags pages.默认情况下,WordPress 使用 /category/ 作为类别 URL 的基础,使用 /tag/ 作为标签页面。

Just like the examples below:就像下面的例子:

https://example.com/category/technology/ https://example.com/tag/fintech/ https://example.com/category/technology/ https://example.com/tag/fintech/

You can change these base prefixes by going to Settings » Permalinks and simply entering new prefixes.您可以通过转到设置»永久链接并简单地输入新前缀来更改这些基本前缀。

Category and tag base类别和标签库

Make sure you click the 'Save Changes' button to update your category base and tag base.确保单击“保存更改”按钮以更新您的类别库和标签库。

Now, you'll have a new category and tag bases active on your website, similar to the examples below:现在,您的网站上将有一个新的类别和标签库处于活动状态,类似于以下示例:

https://example.com/topics/technology/ (for category pages) https://example.com/hashtag/fintech (for tag pages) https://example.com/topics/technology/ (用于类别页面) https://example.com/hashtag/fintech (用于标签页面)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM