IonIon
Packages
  • next
  • current
Changelog
GitHub
Packages
  • next
  • current
Changelog
GitHub
  • Version 0.x

    • Release Notes
    • Upgrade Guide
    • Contribution Guide
    • Security Policy
    • Code of Conduct
    • Origin
  • Packages

    • Introduction
    • Container

      • Introduction
      • Prerequisites
      • How to install
      • Container Instance
      • Bindings
      • Dependencies
      • Resolving
      • Contextual Bindings
    • Contracts

      • Introduction
      • How to install
    • Support

      • Introduction
      • How to install
      • Arrays

        • About Arrays
        • Includes All
        • Includes Any
        • Is Array Like
        • Is Concat Spreadable
        • Is Safe Array Like
        • Is Typed Array
        • Merge
      • Concerns

        • About Concerns
        • Prerequisites
        • Concern Class
        • Using Concerns
        • Aliases
        • Conflict Resolution
        • Booting
        • Hooks
        • Edge Cases
        • JSDoc
      • Exceptions

        • About Exceptions
        • Configure Custom Error
        • Configure Stack Trace
        • Get Error Message
        • Custom Errors
      • Facades

        • About Facades
      • Meta

        • About Meta
        • Prerequisites
        • Supported Elements
        • Set & Get
        • Inheritance
        • Outside Changes
        • TC39 Proposal
        • Target Meta
      • Mixins

        • About Mixins
        • New Mixin
        • Apply Mixins
        • Instanceof
        • Inheritance
        • Onward
      • Object

        • About Objects
        • Forget
        • Forget All
        • Get
        • Has
        • Has All
        • Has Any
        • Has Unique ID
        • Is Cloneable
        • Is Populatable
        • Isset
        • Merge
        • Populate
        • Set
        • Unique ID
      • Reflections

        • About reflections
        • Assert Has Prototype Prop.
        • Class Looks Like
        • Class Own Keys
        • Get All Parents Of Class
        • Get Class Prop. Descriptor
        • Get Class Prop. Descriptors
        • Get Constructor Name
        • Get Name Or Desc. Tag
        • Get Parent Of Class
        • Has All Methods
        • Has Method
        • Has Prototype Property
        • Is Callable
        • Is Class Constructor
        • Is Class Method Reference
        • Is Constructor
        • Is Key Safe
        • Is Key Unsafe
        • Is Method
        • Is Subclass
        • Is Subclass Or Looks Like
        • Is WeakKind
      • Misc

        • About Misc.
        • Desc. Tag
        • Empty
        • Is Key
        • Is Primitive
        • Is Property Key
        • Isset
        • Merge Keys
        • To Weak Ref.
      • Callback Wrapper
    • Vuepress Utils

      • Introduction
      • How to install
      • Navigation

        • Archive
      • Plugins

        • Last Updated
      • Components

        • Version Disclaimer
    • XYZ (test package)

Version Disclaimer

The <VersionDisclaimer /> component is a simply "notice" container, which can be used in your layout. Most often, you would use this to display a custom message when outdated / unsupported documentation is being viewed.

<VersionDisclaimer type="warning" label="Note">
    You are viewing documentation for an unsupported version...
</VersionDisclaimer>

Properties

type (optional)

The type property accepts the following values:

  • info (default)
  • warning
  • danger

label (optional)

An optional label that is used as a prefix for the custom disclaim message.

Extend Default Layout

The following example assumes that you are using an Archive component to structure documentation. When doing so, you can display a custom message whenever "outdated" or "upcoming" documentation is being viewed.

To achieve this, you will need to create a custom layout (e.g. extend the default theme). Create a new layout, e.g. in .vuepress/layouts/Layout.vue.

<script setup lang="ts">
import ParentLayout from '@vuepress/theme-default/layouts/Layout.vue';
import VersionDisclaimer from "@aedart/vuepress-utils/components/VersionDisclaimer.vue";
import {usePageData} from "@vuepress/client";
import {isViewingNextRef, isViewingOtherRef} from "@aedart/vuepress-utils";
import archive from "../my_archive";

const page = usePageData();
const showForNext = isViewingNextRef(page, archive);
const showForOther = isViewingOtherRef(page, archive);
</script>

<template>
  <ParentLayout>
    <template #page-top>
        
      <VersionDisclaimer v-if="showForNext">
        You are viewing documentation for next version...
      </VersionDisclaimer>
        
      <VersionDisclaimer v-if="showForOther" type="danger" label="Oh oh">
        You are viewing old stuff...
      </VersionDisclaimer>

    </template>
  </ParentLayout>
</template>

The isViewingNextRef() method returns a computed property that indicates if visitor is viewing the "next" collection of pages. The isViewingOtherRef() methods returns a computed property that determines if pages are viewed that do not belong to "next" nor "current" collections.

Client Config

In your Client Config File, use the custom Layout.

import { defineClientConfig } from '@vuepress/client';
import Layout from "./layouts/Layout.vue";

export default defineClientConfig({
    layouts: {
        Layout
    }
});
Edit page
Last Updated:
Contributors: Alin Eugen Deac