Custom post types demo in frontity-examples

Hi guys,

Have really been enjoying Frontity, have followed your video on custom post types (vintage vinyl) but when I get to the catalogue page, the links that are generated are absolute paths and my frontity site redirects to the address of the wordpress build.

I got round this by adding …

$link = wp_make_link_relative(get_permalink());

into the wordpress function but now that is sorted, even though the links show correct in frontity, they all go to 404 error pages.

You can see the problem in your demo if you view the catalogue tab in sandbox. Any guidance you can offer would be much appreciated.

Leon.

Hi Leon, am I correct you just want to change some URLs from absolute to relative?

If yes - you could use an custom processor in your app and manipulate them there.

I did something like that in a different :

import Link from "@frontity/components/link";

const maillink = {
  name: "link",
  priority: 10,
  test: ({ node }) => node.component === "a" &&  (node.props["data-type"] === "mailto" || node.props["href"] === "" || node.props["href"] === "mailto:[email protected]" ) ,
  processor: ({ node }) => {
    node.props["className"] = "mailgo"
    const mail = node.props["href"].split('mailto:')[1].split('@')

    const dataaddress = mail[0]
    const datadomain = mail[1]

    node.props["data-id"] = undefined
    node.props["data-address"] = mail[0]
    node.props["data-domain"] = mail[1]
    node.props["href"] = ""
    node.props["target"] = undefined
    console.log(node);

    return node;
  }
};
export default maillink;

Hey @phn, thanks for your help. I have changed the urls from within wordpress and that is working fine, the problem arises when I visit the page in frontity, even with the relative paths the links do not work.

Seen here in the catalogue tab… https://codesandbox.io/s/github/frontity-demos/frontity-examples/tree/master/custom-post-types

I will try and put together my own sandbox to better explain!

Leon.

How old is your repository?

I have seen that on link with query parameters there’s sometimes a few issues, as you are using it, if I am not mistaken, but there’s been a fixed a week ago: Handling urls with question marks.

Or see here: https://github.com/frontity/frontity/issues/596

Hi @leonnockolds,

Yes, a codesandbox would be very helpful to understand your issue.