Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed blog order#147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ikoevska wants to merge14 commits intonativescript-vue:v2
base:v2
Choose a base branch
Loading
fromikoevska:fix-blog-order
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
d0a5aa8
Changed regex that captures date
ikoevskaMay 27, 2018
be1dbde
Testing with more posts
ikoevskaMay 27, 2018
3d40aad
Print date from file name in log
ikoevskaMay 27, 2018
eec3eef
Console log
ikoevskaMay 27, 2018
1decb99
Removing console log
ikoevskaMay 27, 2018
92e0b37
Updated regex for date in filename
ikoevskaMay 27, 2018
a43674e
Change sorting after fixing order
ikoevskaMay 27, 2018
fb1dd72
Adding more posts for testing
ikoevskaMay 27, 2018
75ff0b3
Tweaking regex to work for dates and numbered file names
ikoevskaMay 27, 2018
cbf969e
Applying order plugin for all
ikoevskaMay 27, 2018
fde8428
Including blog folder
ikoevskaMay 27, 2018
cc9e243
Removing test blog posts
ikoevskaMay 27, 2018
ad3e32a
Order takes the timestamp
ikoevskaJun 9, 2018
9f5386a
refactor: use non-capturing groups
rigor789Jun 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionbuild/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,7 +122,7 @@ Metalsmith(cwd)
.use(collections({
blog: {
pattern: 'blog/*.md',
sortBy: 'date',
sortBy: 'order',
reverse: true,
refer: false
},
Expand Down
8 changes: 4 additions & 4 deletionsbuild/plugins/order.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,15 +4,15 @@ function plugin() {

return function (files, metalsmith, done) {
Object.keys(files).forEach((file) => {
if (!file.includes('docs')) {
if (!file.includes('docs' || 'blog')) {
return
}


const res = path.basename(file).match(/^(\d+)-/);
const res = path.basename(file).match(/^(?:(?:\d+)-)+/);
if (res) {
const data = files[file];
data.order = res[1];
data.order = res[0].replace(/-/g, '');

data.slug = data.slug.replace(res[0], '');

Expand All@@ -24,4 +24,4 @@ function plugin() {
}
}

module.exports = plugin;
module.exports = plugin;

[8]ページ先頭

©2009-2025 Movatter.jp