Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: facebook template not working #3159

Closed
yangshun opened this issue Jul 30, 2020 · 3 comments · Fixed by #3168
Closed

v2: facebook template not working #3159

yangshun opened this issue Jul 30, 2020 · 3 comments · Fixed by #3168
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@yangshun
Copy link
Contributor

🐛 Bug Report

Unable to start a website using the Facebook template via @docusaurus/init

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

Both public and internal methods aren't working:

npx @docusaurus/init@next init website facebook
cd packages/docusaurus-init/templates/facebook && yarn start

Expected behavior

Site runs

Actual Behavior

Public

$ docusaurus build
Creating an optimized production build...
A validation error occured.
The validation system was added recently to Docusaurus as an attempt to avoid user configuration errors.
We may have made some mistakes.
If you think your configuration is valid and should keep working, please open a bug report.
ValidationError: "footer.links[3].items[0].target" is not allowed
error Command failed with exit code 1. 

Internal

Starting the development server...
Error: The field(s) 'onBrokenLinks' are not recognized in docusaurus.config.js.
If you still want these fields to be in your configuration, put them in the 'customFields' attribute.

Your Environment

v2.0.0-alpha.60

Reproducible Demo

Refer to above.

This is because the footer links are still contains target and rel which are not allowed in the Joi schema. The error for the internal case is probably another related schema issue.

@yangshun yangshun added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jul 30, 2020
@yangshun
Copy link
Contributor Author

This was reported by @brianjo internally. I told him to remove the offending fields in his docusaurus.config.js for now. Based on what I'm seeing in the theme footer implementation, not allowing users to customize target and rel is intended. So maybe we just have to update the template.

@slorber
Copy link
Collaborator

slorber commented Jul 30, 2020

I don't think it's true, as we spread the props:

function FooterLink({to, href, label, prependBaseUrlToHref, ...props}) {
  const toUrl = useBaseUrl(to);
  const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});

  return (
    <Link
      className="footer__link-item"
      {...(href
        ? {
            target: '_blank',
            rel: 'noopener noreferrer',
            href: prependBaseUrlToHref ? normalizedHref : href,
          }
        : {
            to: toUrl,
          })}
      {...props}>
      {label}
    </Link>
  );
}

as we add _blank and noopener by default, it can be removed from the template, but I think we should allow users to override these defaults if he wants to.

Some users have recently reported wanting to use _self in the navbar for example, I wouldn't be surprised if the need exists for the footer too.

@yangshun
Copy link
Contributor Author

but I think we should allow users to override these defaults if he wants to.

Then we should add it to the Joi schema, it's currently preventing people from using those fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants