vike icon indicating copy to clipboard operation
vike copied to clipboard

Setting `+redirects` improve alias support

Open brillout opened this issue 7 months ago • 3 comments

Description

Maybe as a new setting +alias? Or maybe +redirects.alias? To save client-side KBs it would be nice to not send the whole redirects setting to the client-side.

See also:

  • https://vike.dev/redirects#alias
  • https://github.com/vikejs/vike/issues/2375

brillout avatar Apr 15 '25 12:04 brillout

It would be really nice to have those new settings:

  • +alias for client-side redirection
  • +appName as a complement to the title to combine themes in the tabs, among other things

I'm waiting for the new release!

In the meantime, I've implemented the following:

// +onBeforeRender.ts
import { render } from "vike/abort";
import type { OnBeforeRenderAsync } from "vike/types";

export const onBeforeRender: OnBeforeRenderAsync = async (pageContext) => {
  console.log(pageContext.urlPathname);

  if (pageContext.urlPathname === "/terms-and-conditions-of-sale") {
    throw render("/terms-of-service");
  }
  if (pageContext.urlPathname === "/terms-and-conditions-of-use") {
    throw render("/terms-of-service");
  }
};

ghost avatar Apr 15 '25 13:04 ghost

to combine themes in the tabs, among other things

Can you elaborate at https://github.com/vikejs/vike/issues/2151?

brillout avatar Apr 15 '25 14:04 brillout

to combine themes in the tabs, among other things

Can you elaborate at https://github.com/vikejs/vike/issues/2151?

I'm in ಠ⁠ᴥ⁠ಠ

ghost avatar Apr 15 '25 18:04 ghost