question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Older/newer posts label in blog plugin should be configurable

See original GitHub issue

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I’m using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Older/newer posts label in blog plugin should be configurable. If you want to use the blog engine to post other content (like release notes), the term ‘post’ becomes irrelevant in this context.

Reproducible demo

No response

Steps to reproduce

Expected behavior

Configuration option (as described in https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog) should be possible.

Actual behavior

Not configurable.

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I’d be willing to fix this bug myself.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
slorbercommented, Apr 27, 2022

You can try this conditional logic after swizzling the component:

import useRouteContext from '@docusaurus/useRouteContext';

export default function BlogListPaginator(props: Props): JSX.Element {
  const isReleaseNotes = useRouteContext().plugin.id === "release-notes"

  return (
       isReleaseNotes ? 
            <Translate
                id="MY_ID">
                MY_CUSTOM_MESSAGE
            </Translate>
		       : 
            <Translate
                id="theme.blog.paginator.olderEntries"
                description="The label used to navigate to the older blog posts page (next page)">
                Older Entries
            </Translate>
     );
}

useRouteContext is experimental/undocumented for now but we’ll likely keep this feature even if it’s refactored.

You can also use useLocation().pathname.startsWith("/release-notes/") or whatever else makes sense for your use-case

1reaction
wgruszczykcommented, Apr 29, 2022

Thank you for the hints! Probably at the moment the most sensible and safe solution will be to translate it permanently to something more general like Next/Previous.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to properly use labels as categories on Blogger - XOmisse
Beginners guide to blogging on Blogger - How to properly use labels as categories or post topics to organise content.
Read more >
News Manager (updated) - GetSimple CMS
Not my design. This plugin was created by roog, I'm just trying to update and maintain it. ... In the next News Manager...
Read more >
Showing all posts with a given label - Blogger Community
Hey, been fighting with this for some time with no solution. On my site (webnesia.com), I have labels that I attach to each...
Read more >
WP Blog Post Layouts – WordPress plugin
Versatile plugin specially designed to create beautiful posts layouts. Fully compatible with Gutenberg and Elementor. Comes with advanced features suc …
Read more >
How to Create a Separate Page for Blog Posts in WordPress
You can create a separate page for blog posts using WordPress alone, without needing a plugin. However, this method takes a little more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found