Comments (3)
๐ I need as well and there doesn't appear to be a way available with the plugin currently. However, I've modified my copy to support it when provided options in the following format:
.use(permalinks({
{posts: {pattern: '/:collection/:date/:title'}},
{pages: {pattern: '/:collection/:title'}},
{"*": {pattern: '/:title'}}
})
Gist: https://gist.github.com/misterdai/84fa94cd382e66262357
The modification simply checks for a permalink rule that matches the collection name or it'll default to the wildcard *
for any other file or unmatched collection. If there's no global rule or matching collection, it'll skip creating the permalink for the file.
I think collection based permalinks may be better as a separate plugin, but I'll leave it up to @ianstormtaylor to decide that :)
from permalinks.
Just came here on a somewhat related issue and noticed this. I had problems with it for a while, but the solution I went with was to use metalsmith-branch
to branch my blog posts separately (they're nested under a different src/ folder. relevant section:
.use( branch('blog/posts/**')
.use( permalinks({
pattern: 'blog/:date/:title',
date: 'YYYY/MM',
}))
)
My problem now is how to handle relative files to bring them over in nested folders, but I'll open another issue for that.
from permalinks.
Hello, so it's been a while since I asked that question and digging deeper into Metalsmith just gave me indication that I didn't treat it as it supposed to be. Here is what I've done to solve my problem.
.use(copy({
pattern: 'pages/*',
directory: '/'
}))
.use(ignore(['pages/*',".DS_Store"]))
.use(permalinks({
pattern: ':date/:title',
date: 'YYYY/MM'
}))
Thus, this plugins does it's job correctly, and it is job of other similarly simple and straightforward plugins to do the rest. Simplicity is a king in Metalsmith, I'm loving it..
from permalinks.
Related Issues (20)
- Add coverage
- Replace substitute package HOT 1
- unique option output (both default & custom) are hard to control. HOT 1
- Default linkset options overwrite further linksets
- Org migration alignment
- Get rid of unmaintained substitute dependency
- Generate an SEO inner link when we don't need it HOT 2
- Provide dual ESM/CJS build
- permalinks 3.0.0 roadmap
- Replace momentjs with alternative HOT 1
- Deprecate (and remove?) the "relative" option
- Using date in linksets throwing an exception HOT 2
- options unique & duplicatesFail overlap in functionality
- v2.5.0 broke the `slug` option HOT 7
- Allow Processing Before Metalsmith-In-Place HOT 7
- permalinks generates unbrowseable urls HOT 7
- [question] aftert or before metalsmith-markdown? HOT 2
- "ยต" should not appear in a url HOT 3
- 2 tests failing on clean 2.2.0 repo HOT 1
- Colon in pattern causes crash or hanged process HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from permalinks.