
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@apostrophecms/anchors
Advanced tools
A module bundle that supports linking to individual Apostrophe widgets.
Enable deep linking and smooth navigation with automatic anchor generation for all ApostropheCMS widgets. Perfect for landing pages, documentation sites, and content-heavy applications where users need to link directly to specific sections.
To install the module, use the command line to run this command in an Apostrophe project's root directory:
npm install @apostrophecms/anchors
Configure the anchor modules in the app.js
file:
import apostrophe from 'apostrophe';
apostrophe ({
root: import.meta,
shortName: 'my-project',
modules: {
'@apostrophecms/anchors': {},
}
});
When the modules are active, all widget types will have a new "HTML Anchor Value" field. When an editor populates that field with a slug-style string, the widget HTML markup will be wrapped with a new div
with an attribute (an id
by default) set to the anchor value. This attribute can be targeted by anchor links, e.g., href="#anchor-id-value"
.
The only Apostrophe core widget type with this feature disabled is the rich text widget, @apostrophecms/rich-text-widget
.
The "HTML Anchor Value" field is a "slug" type field, which means it is limited to lowercase characters and dashes for consistent usage.
anchorAttribute
By default, the anchor attribute is an id
. This makes it easy to link to the widget with a hash href
matching the anchor value as described above. Developers have the option to use another anchor attribute if they prefer to target the HTML element with custom JavaScript instead.
To do this, include an anchorAttribute
option on the individual widget type. You can also add this option on the root @apostrophecms/widget-type
module or the @apostrophecms/anchors-widget-type
module to set this for all widget types.
// modules/my-banner-widget/index.js
export default {
options: {
anchorAttribute: 'data-anchor'
}
};
In this example the wrapping div
element would look like this:
<div data-anchor="anchor-id-value">
<!-- Normal widget markup here -->
</div>
anchors: false
Developers can choose to disable this module's features for any widget type by setting an anchors: false
option on the widget type.
// modules/my-banner-widget/index.js
export default {
options: {
anchors: false
}
};
This is automatically set for the rich text widget. That can be reversed by setting anchors: true
on @apostrophecms/rich-text-widget
.
anchorDefault
To help content editors populate anchor values automatically, set the anchorDefault
option to the name of an existing field on a widget type. The "HTML Anchor Value" field will populate automatically based on the value of the named field using the following
field option mechanism.
// modules/my-banner-widget/index.js
export default {
options: {
anchorDefault: 'heading'
},
fields: {
add: {
heading: {
type: 'string',
label: 'Heading'
}
}
}
};
Landing Pages: Create marketing pages where different sections can be linked to directly from emails, ads, or social media.
Documentation: Allow readers to bookmark and share links to specific sections of your documentation.
Long-form Content: Help readers navigate lengthy articles or reports by providing direct links to sections.
Campaign Pages: Enable marketing campaigns to link directly to specific product features or testimonials.
⚠️ Current Limitation: The configuration options described above (like
anchorAttribute
,anchors: false
, andanchorDefault
) are not currently passed through to headless frontends like Astro. These options only work in traditional ApostropheCMS projects. We're working on improving this integration.
When using ApostropheCMS as a headless CMS with an Astro frontend, you can still implement anchor functionality by manually handling the anchor data in your Astro components. You can also pass options to individual widgets on a per-area basis, but you will have to alter the code examples below to handle these options.
In your Astro frontend, create components/WidgetWrapper.astro
with the following content:
---
const { widget } = Astro.props;
const hasAnchor = widget?.anchorId;
---
{
hasAnchor ? (
<div id={widget.anchorId}>
<slot />
</div>
) : (
<slot />
)
}
Then go to your widget components (e.g., widgets/ImageWidget.astro
) and wrap their existing content with the WidgetWrapper:
// Before
---
<Figure {image} {link} caption={widget.caption} {style} />
// After
---
import WidgetWrapper from '../components/WidgetWrapper.astro';
---
<WidgetWrapper {widget}>
<Figure {image} {link} caption={widget.caption} {style} />
</WidgetWrapper>
Benefits of this approach:
WidgetWrapper.astro
New to using ApostropheCMS with Astro? Check out our starter kits:
Made with ❤️ by the ApostropheCMS team. Found this useful? Give us a star on GitHub! ⭐
1.0.2 (2025-08-06)
FAQs
A module bundle that supports linking to individual Apostrophe widgets.
We found that @apostrophecms/anchors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.