
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@gitlab/nuxt-edit-this-page
Advanced tools
Add an "Edit this page" link to your Nuxt pages
This module let's you add "Edit this page" links to your Nuxt project's pages. The link opens the web IDE for the active file, which is the page's Vue file by default but that can be changed as needed by using a custom path resolver.
yarn add @gitlab/nuxt-edit-this-page
# Or npm i @gitlab/nuxt-edit-this-page
@gitlab/nuxt-edit-this-page
to the modules
section in nuxt.config.js
.// nuxt.config.js
{
modules: [
'@gitlab/nuxt-edit-this-page',
],
}
editThisPage
key to nuxt.config.js
.// nuxt.config.js
{
editThisPage: {
// Module options
}
}
When enabled, the module registers a global component that you can use to display an "Edit this page" link in any of your page. The component will automatically generate a link based on the route that's being visited so that you can quickly access the live editor on the Git hosting service.
<template>
<edit-this-page-link />
</template>
The component accepts a few props to customize the ads you display.
String
: requiredThe remote Git repository where the files reside, can be an HTTPS URL or an SSH address.
Example:
// nuxt.config.js
{
editThisPage: {
repo: 'git@gitlab.com:gitlab-org/frontend/nuxt-edit-this-page.git',
// Or
// repo: 'https://gitlab.com/gitlab-org/frontend/nuxt-edit-this-page.git',
// Also works with the project's URL
// repo: 'https://gitlab.com/gitlab-org/frontend/nuxt-edit-this-page',
}
}
String
'blob'
The path
option is appended to the base edit URL. By default, the blob path is used, which produces URLs like https://gitlab.com/gitlab-org/frontend/nuxt-edit-this-page/blob/master/README.md
. This option could be used to make the URL point to the edit path directly, ie setting path
to 'edit'
would produce URLs like https://gitlab.com/gitlab-org/frontend/nuxt-edit-this-page/edit/master/README.md
.
String
'master'
Git branch to use when editing files.
String
'Edit this page'
Text to show when rendering the link.
String
'EditThisPageLink'
The component's name.
The component accepts a few props that let you override the module's options if needed.
String
Base URL to prepend to the file path when generating the edit link. This is computed automatically based on the repo
and branch
options, use it when you need to override the URL on a case-per-case basis.
String
Text to show when rendering the link. Defaults to the value set in the module's options.
The component exposes a scoped slot that you can use to customize the rendering if props are too limited. The slot receives a property href
that contains the computed edit URL.
Example
<template>
<edit-this-page-link>
<template v-slot:default="{ href }">
<span>Customized link pointing to {{ href }}</span>
</template>
</edit-this-page-link>
</template>
Sometimes, your pages display contents from other files and you might want the "Edit this page" link to point to the included file, rather than the visited page's component. This can be achieved by adding an editThisPage.resolve
option to your page. editThisPage.resolve
is a function that receives the current route and should return the computed file path relative to the repository's root.
Example:
<template>
<!-- pages/_slug.vue -->
</template>
<script>
export default {
editThisPage: {
resolve({ route }) {
const { slug } = route.params;
return `docs/${slug}.md`;
},
},
};
</script>
yarn install
yarn dev
Copyright (c) GitLab
FAQs
Add an 'Edit this page' link to your Nuxt pages
The npm package @gitlab/nuxt-edit-this-page receives a total of 2,137 weekly downloads. As such, @gitlab/nuxt-edit-this-page popularity was classified as popular.
We found that @gitlab/nuxt-edit-this-page demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.