Skip to content

URL support for hashnode posts in recent posts plugin#206

Closed
luisfalconmx wants to merge 2 commits intolowlighter:masterfrom
luisfalconmx:hashnode-recent-posts-plugin
Closed

URL support for hashnode posts in recent posts plugin#206
luisfalconmx wants to merge 2 commits intolowlighter:masterfrom
luisfalconmx:hashnode-recent-posts-plugin

Conversation

@luisfalconmx
Copy link

Hi, I made some improvements to the recent posts plugin specifically for hashnode.

URL Support

First add the option Posts custom url where a custom url can be inserted if required.
scrnli_4_4_2021_5-54-21 PM

If the previous option has the value "no" then the url will be "https://USER.hashnode.dev/" (USER will be replaced by the provided github user)

The generated url will be inserted in the title and description of each post to create a link to the post.

scrnli_4_4_2021_6-08-37 PM

Minor change in GraphQL Query

In the query the page had the value 1. This will show the publications from the tenth which does not meet the purpose of the plugin.

Just change from 1 to 0 so that it shows exactly the most recent posts.

This change is too simple, but I had to explain it.

query PostsHashnode {
  user(username: "$user") {
    publication {
      posts(page: 0) {
        title
        brief
        coverImage
        dateAdded
        slug
      }
    }
  }
}

Copy link
Owner

@lowlighter lowlighter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the query bugfix it's ok 👍🏼


As for the url support, unfortunately it won't work when embed on GitHub 😕
I think it's done to reduce risk of HTML injections, but AFAIK GitHub remove all interactivity from SVG images before rendering them (including external links and hover animations), so you can only choose to redirect to either image source or to a single url using markdown.

It may have changed since though, so what you can try is to switch your metrics workflow to your fork and test whether your posts links on your profile readme do work

- uses: luisfalconmx/metrics@hashnode-recent-posts-plugin
  with:
    # options

If it does, I'll merge the remaining changes 🙂

@luisfalconmx
Copy link
Author

I have done the tests as you mention and the link just doesn't work.
https://github.com/luisfalconmx/luisfalconmx

I suppose that the code of this branch does not add value other than the change in the query, so I do not consider that the changes in the master branch are mixed.

@lowlighter
Copy link
Owner

Yeah, it does only when checking the raw image 😕
You can still resubmit only the query changes if you still want to fix the 10-offset

There is a project to create a "markdown" template (though it's still in early design) but you'll be able to use metrics data and format them how you want, including clickable links so ultimately it'll be possible in the future 🙂

@lowlighter
Copy link
Owner

With next release you'll be able to use the upcoming markdown posts plugin from the markdown template.

It won't solve exactly the fact that links are not clickable within SVG images, but I guess it's still a suitable workaround, some plugins are better as textual versions (only drawback is that it does requires a bit more work to setup)

Thanks a lot for your interest in metrics and for contributing 🙂

@luisfalconmx luisfalconmx deleted the hashnode-recent-posts-plugin branch April 8, 2021 11:10
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants