Same question as this: GraphQL sorting case insensitive i.e. I need to sort the results of the query alphabetically but it is returning the posts starting with capital letters first, then lowercase. I just want completely alphabetical.
But I don't know how to make the answer in the above work with Gatsby.
My query looks like this:
query {
allMdx(
sort: {fields: frontmatter___title, order: ASC}
) {
nodes {
frontmatter {
title
slug
}
id
}
}
}
My component looks like this:
const AlphabeticalIndex = ({data}) => {
return (
<Layout pageTitle="Alphabetical Index">
<div>
{
data.allMdx.nodes.map(node => (
<p key={node.frontmatter.title} className={listLink}>
<Link to={"/" + node.frontmatter.slug}>
{node.frontmatter.title}
</Link>
</p>
))
}
</div>
</Layout>
)
}
The site is live and you can see the current result of the query here https://ausdict.translatableenglish.com/entry-index (content warning for swear words).
Thanks for the help.