You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress:子页面‘blog’文章显示异常问题求助

Troubleshooting: Blog Page Showing Index Content Despite Correct Template Setup

Hey there, let's work through this frustrating issue where your /blog page is displaying content from your index page, even after you've configured the templates as intended. Here are actionable steps to diagnose and fix the problem:

  • Verify Routing/URL Mapping
    No matter if you're using a static site generator (Hugo, Jekyll), CMS (WordPress, Drupal), or custom framework, double-check that the /blog path is mapped to the correct template and content source. For example:

    • In static generators, ensure your blog directory has its own index.html template that's pulling from blog-specific data (not the homepage's data context).
    • In CMS platforms, confirm the blog page is assigned to the dedicated blog template, not the homepage template.
  • Inspect Template Inheritance & Variable Scope
    If your templates use inheritance (Liquid, Twig, Django templates), it's easy to accidentally pull index page data into the blog template. Look for:

    • Hardcoded variables like {{ site.home_content }} instead of context-aware ones like {{ page.content }}
    • Shared partials that are tied to the homepage instead of using dynamic content based on the current page
  • Flush All Caches
    Caching is one of the most common hidden causes here. Even if you fixed the root issue, old cached content might still be loading:

    • Do a browser hard-refresh with Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
    • For CMS platforms, flush plugin caches and server-side caches (Redis, Varnish)
    • For static generators, run a full clean rebuild (e.g., hugo --cleanDestinationDir or jekyll clean && jekyll build) to eliminate leftover old files
  • Check Server Rewrite Rules
    If you're using Apache or Nginx, examine your rewrite rules to ensure they aren't redirecting /blog to the index page. For example, an overly broad rule like RewriteRule ^.*$ index.html [L] would force all requests to load the index content. Adjust rules to exclude the /blog path or make them more specific.

  • Rule Out Duplicate Slugs/Conflicting Content
    In CMS systems, check if there's a post or page with the slug blog that's incorrectly using the homepage template. Also, verify that the homepage isn't set to pull content from the blog section by mistake—some CMS let you assign dynamic content to the homepage that might overlap.

  • Isolate the Template for Debugging
    Create a minimal test template for /blog with only hardcoded text (e.g., <h1>This is the Blog Page</h1>) and assign it to the route. If this test content shows up correctly, the issue is in your original template's data logic. If it still shows index content, the problem lies in routing or server config.


内容的提问来源于stack exchange,提问作者k_turek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:39:30