Skip to content

Commit bb876d7

Browse files
authored
Merge pull request #10 from ameen4455/admin_page
fix author page
2 parents a728393 + 78ebb73 commit bb876d7

File tree

6 files changed

+24
-29
lines changed

6 files changed

+24
-29
lines changed

gatsby-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ exports.createPages = async ({ graphql, actions }) => {
108108

109109
// This part here defines, that our author pages will use
110110
// a `/author/:slug/` permalink.
111-
const url = `/author/${node.slug}`;
111+
const url = `author/${node.slug}`;
112112

113113
const items = Array.from({ length: totalPosts });
114114

@@ -118,9 +118,9 @@ exports.createPages = async ({ graphql, actions }) => {
118118
items: items,
119119
itemsPerPage: postsPerPage,
120120
component: authorTemplate,
121-
pathPrefix: ({ pageNumber }) =>
122-
pageNumber === 0 ? url : `${url}/page`,
121+
pathPrefix: url,
123122
context: {
123+
pathPrefix: url,
124124
slug: node.slug,
125125
},
126126
});

src/components/common/Pagination.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ const Pagination = ({ pageContext }) => {
99
const { previousPagePath, nextPagePath, pageNumber, numberOfPages, pathPrefix } =
1010
pageContext;
1111

12-
console.log(pageContext)
13-
1412
function handlePageClick(e) {
15-
if (e.selected == 0) {
16-
navigate(`/${pathPrefix}`)
17-
} else {
18-
navigate(`/${pathPrefix}/${e.selected + 1}`)
13+
if (e.selected !== pageNumber ){
14+
if (e.selected == 0) {
15+
navigate(`/${pathPrefix}`)
16+
} else {
17+
navigate(`/${pathPrefix}/${e.selected + 1}`)
18+
}
1919
}
2020
}
2121

src/components/common/PostCardBlog.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@ const PostCardBlog = ({ post, number }) => {
2323
<div className=" md:w-2/3">
2424
<header className="post-card-header mt-4">
2525
<div className="line-clamp-1 overflow-clip">
26-
{post.tags.map((tag, index) => (
27-
<span
28-
key={index}
29-
className={`bg-slate-100 ${
30-
index > 0 ? "hidden md:inline" : ""
31-
} capitalize text-slate-500 mr-2 py-1 px-2 rounded-lg text-sm`}
32-
>
33-
{tag.name}
34-
</span>
35-
))}
26+
<Link
27+
to={`/tag/${post.primary_tag?.slug}`}
28+
className={`bg-slate-100 capitalize hover:underline text-slate-500 mr-2 py-1 px-2 rounded-lg text-sm`}
29+
>
30+
{post.primary_tag?.name}
31+
</Link>
3632
</div>
3733
{post.featured && <span>Featured</span>}
3834
<h2 className="text-lg mt-2 md:text-xl mb-1 text-heading-black font-bold hover:underline">
@@ -44,9 +40,9 @@ const PostCardBlog = ({ post, number }) => {
4440
</section>
4541
<div>
4642
{post.authors.map((author, index) =>
47-
<span className=" text-sm font-semibold text-neutral-600 hover:underline">
43+
<Link to={`/author/${author.slug}`} key={index} className=" text-sm font-semibold text-neutral-600 hover:underline">
4844
{author.name} { index !== post.authors.length - 1 && "& "}
49-
</span>
45+
</Link>
5046
)}
5147
</div>
5248
<footer className="flex text-sm font-light">

src/templates/author.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import { MetaData } from "../components/common/meta";
1414
const Author = ({ data, location, pageContext }) => {
1515
const author = data.ghostAuthor;
1616
const posts = data.allGhostPost.edges;
17-
const twitterUrl = author.twitter
18-
? `https://twitter.com/${author.twitter.replace(/^@/, ``)}`
19-
: null;
20-
const facebookUrl = author.facebook
21-
? `https://www.facebook.com/${author.facebook.replace(/^\//, ``)}`
22-
: null;
17+
// const twitterUrl = author.twitter
18+
// ? `https://twitter.com/${author.twitter.replace(/^@/, ``)}`
19+
// : null;
20+
// const facebookUrl = author.facebook
21+
// ? `https://www.facebook.com/${author.facebook.replace(/^\//, ``)}`
22+
// : null;
2323

2424
return (
2525
<>

src/templates/post.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { readingTime as readingTimeHelper } from "@tryghost/helpers";
1616
*/
1717
const Post = ({ data, location }) => {
1818
const post = data.ghostPost;
19-
console.log(post)
2019
const readingTime = readingTimeHelper(post);
2120

2221
const addDefaultSrc = (e) => {

src/utils/siteConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
? process.env.SITE_URL || `https://internetfreedom-in.pages.dev`
66
: `https://internetfreedom-in.pages.dev`, // Site domain. Do not include a trailing slash!
77

8-
postsPerPage: 3, // Number of posts shown on paginated pages (changes this requires sometimes to delete the cache)
8+
postsPerPage: 8, // Number of posts shown on paginated pages (changes this requires sometimes to delete the cache)
99

1010
siteTitleMeta: `Ghost Gatsby Starter`, // This allows an alternative site title for meta data for pages.
1111
siteDescriptionMeta: `A starter template to build amazing static websites with Ghost and Gatsby`, // This allows an alternative site description for meta data for pages.

0 commit comments

Comments
 (0)