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
canonical-url includes double // and no trailing slash #9524
Comments
The top-level index page receives double-slashes, too: <link rel="canonical" href="https://quarto.org//"> |
This comment was marked as outdated.
This comment was marked as outdated.
I've found where the additional
export function synthesizeCitationUrl(
input: string,
metadata: Metadata,
outputFile?: string,
offset?: string,
) {
const siteMeta = metadata[kWebsite] as Metadata | undefined;
let baseUrl = siteMeta?.[kSiteUrl] as string;
baseUrl = baseUrl.replace(/\/$/, "");
if (baseUrl && outputFile && offset) {
const rootDir = normalizePath(join(dirname(input), offset));
if (outputFile === "index.html") {
return `${baseUrl}/${
pathWithForwardSlashes(relative(rootDir, dirname(input)))
}`;
} else {
const relativePath = relative(
rootDir,
join(dirname(input), basename(outputFile)),
);
const part = pathWithForwardSlashes(relativePath);
return `${baseUrl}/${part}`;
}
} else {
// The url is unknown
return undefined;
}
} Resolves the issue. I am not aware of the requirement for a trailing |
We have to be very careful about how to resolve this in the case of I know many people think this is ugly, but I think I believe that as of right now, Aron's "expected behavior" is what we expected to do. The actual behavior is completely broken, but I think we should instead fix it to |
So the function would be: something like below? export function synthesizeCitationUrl(
input: string,
metadata: Metadata,
outputFile?: string,
offset?: string,
) {
const siteMeta = metadata[kWebsite] as Metadata | undefined;
let baseUrl = siteMeta?.[kSiteUrl] as string;
baseUrl = baseUrl.replace(/\/$/, "");
if (baseUrl && outputFile && offset) {
const rootDir = normalizePath(join(dirname(input), offset));
if (outputFile === "index.html") {
const part = pathWithForwardSlashes(relative(rootDir, dirname(input)));
if (part.length === 0) {
return `${baseUrl}/`;
} else {
return `${baseUrl}/${part}/`;
}
} else {
const relativePath = relative(
rootDir,
join(dirname(input), basename(outputFile)),
);
const part = pathWithForwardSlashes(relativePath);
return `${baseUrl}/${part}`;
}
} else {
// The url is unknown
return undefined;
}
} |
Show me the diffs in a PR? |
coming right up. edit: |
I'll also note that I went to configure If Quarto could emit only |
Huh. I think that's a problem with the crawler, for similar reasons as I stated above :( Unfortunately, there's no guarantee that |
I see your problems with the crawler and raise you: quarto-cli/src/resources/projects/website/navigation/quarto-nav.js Lines 271 to 279 in a604268
I don't want to shift the purpose of this issue, which is reporting URL construction problems. |
Bug description
Given a Quarto project configuration:
The
about/index.qmd
file receives the following tag:This link tag has two problems:
site-url
with the page path.Steps to reproduce
Create a Quarto project with an index file in a subdirectory. Render that project. Look at the generated HTML.
Expected behavior
Actual behavior
Your environment
No response
Quarto check output
The text was updated successfully, but these errors were encountered: