feat: Not able to pull publication title from Hashnode #22

Merged
create-issue-branch[bot] merged 4 commits from issue-21-Not_able_to_pull_publication_tit into main 2024-03-15 21:25:49 +00:00
2 changed files with 15 additions and 5 deletions
Showing only changes of commit 61fffbd600 - Show all commits

View File

@ -6,13 +6,23 @@ export const getClient = () => {
return new GraphQLClient("https://gql.hashnode.com")
}
export function removeHTTPSProtocol(url: string) {
return url.replace(/^https?:\/\//, '');
}
export function removeHTTPProtocol(url: string) {
const fixHTTPS = removeHTTPSProtocol(url);
return fixHTTPS.replace(/^http?:\/\//, '');
}
const newURL = removeHTTPProtocol(config.hashnodeURL);
export const getAllPosts = async () => {
const client = getClient();
const allPosts = await client.request<AllPostsData>(
gql`
query allPosts {
publication(host: "${config.hashnodeURL}") {
publication(host: "${newURL}") {
title
posts(first: 20) {
pageInfo{
@ -56,7 +66,7 @@ export const getPost = async (slug: string) => {
const data = await client.request<PostOrPageData>(
gql`
query postDetails($slug: String!) {
publication(host: "${config.hashnodeURL}") {
publication(host: "${newURL}") {
post(slug: $slug) {
author{
name
@ -92,7 +102,7 @@ export const getAboutPage = async () => {
const page = await client.request<PostOrPageData>(
gql`
query pageData {
publication(host: "${config.hashnodeURL}") {
publication(host: "${newURL}") {
staticPage(slug: "about") {
title
content {
@ -114,7 +124,7 @@ export const getPublication = async () => {
const data = await client.request<PublicationData>(
gql`
query pubData {
publication(host: "${config.hashnodeURL}") {
publication(host: "${newURL}") {
title
displayTitle
descriptionSEO

View File

@ -10,7 +10,7 @@ export default defineConfig({
// }),
integrations: [
astroHashnode({
hashnodeURL: "astroplayground.hashnode.dev",
hashnodeURL: "https://astroplayground.hashnode.dev",
verbose: true,
disableViewTransitions: false,
})