Skip to content

Commit 2e3a289

Browse files
authored
Merge pull request #110 from GetPublii/0.29.1-release
0.29.1 release
2 parents cdee761 + 04b8724 commit 2e3a289

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+875
-319
lines changed

app/back-end/builddata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"0.28.1","build":10966,"status":"Beta"}
1+
{"version":"0.28.1","build":10999,"status":"Beta"}

app/back-end/modules/deploy/gitlab-pages.js

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class GitlabPages {
255255
});
256256
}
257257

258-
return this.makeCommit(this.filesToRemove, this.updateTextFiles.bind(this), 'Publii - remove files');
258+
return this.makeCommit(this.filesToRemove, this.updateTextFiles.bind(this), '[skip ci] Publii - remove files');
259259
}
260260

261261
console.log('(!) NO FILES TO REMOVE DETECTED');
@@ -295,7 +295,7 @@ class GitlabPages {
295295

296296
if (this.filesToUpdate.length) {
297297
console.log('(!) TEXT FILES TO UPDATE DETECTED');
298-
return this.makeCommit(this.filesToUpdate, this.uploadTextFiles.bind(this), 'Publii - update non-binary files');
298+
return this.makeCommit(this.filesToUpdate, this.uploadTextFiles.bind(this), '[skip ci] Publii - update non-binary files');
299299
}
300300
}
301301

@@ -336,7 +336,7 @@ class GitlabPages {
336336

337337
if (this.filesToUpdate.length) {
338338
console.log('(!) TEXT FILES TO UPLOAD DETECTED');
339-
return this.makeCommit(this.filesToUpdate, this.createBinaryFilesList.bind(this), 'Publii - upload non-binary files');
339+
return this.makeCommit(this.filesToUpdate, this.createBinaryFilesList.bind(this), '[skip ci] Publii - upload non-binary files');
340340
}
341341
}
342342

@@ -388,14 +388,21 @@ class GitlabPages {
388388

389389
updateBinaryFiles () {
390390
if (this.binaryFilesToUpdate.length) {
391-
this.binaryFilesUploadedCount++;
392-
let progress = Math.floor(this.currentUploadProgress + this.binaryProgressOffset);
391+
let commits = [];
392+
let progress = this.currentUploadProgress;
393+
394+
for (let i = 1; i <= 10 && this.binaryFilesToUpdate.length; i++) {
395+
progress = progress + this.binaryProgressOffset;
396+
this.binaryFilesUploadedCount++;
397+
let commit = this.binaryFilesToUpdate.shift();
398+
commit.content = this.readFile(path.join(this.deployment.inputDir, commit.file_path.substr(7)));
399+
commits.push(commit);
400+
}
401+
393402
let operations = [this.binaryFilesUploadedCount, this.binaryFilesToUploadCount];
394-
let commit = this.binaryFilesToUpdate.shift();
395-
commit.content = this.readFile(path.join(this.deployment.inputDir, commit.file_path.substr(7)));
396403
this.setUploadProgress(progress, operations);
397-
console.log('(!) BINARY FILE UPDATED');
398-
this.makeCommit([commit], this.updateBinaryFiles.bind(this), 'Publii - update public/' + commit.file_path);
404+
console.log('(!) BINARY FILES UPDATED');
405+
this.makeCommit(commits, this.updateBinaryFiles.bind(this), '[skip ci] Publii - update ' + commits.length + ' files');
399406
return;
400407
}
401408

@@ -406,14 +413,21 @@ class GitlabPages {
406413

407414
uploadBinaryFiles () {
408415
if (this.binaryFilesToUpload.length) {
409-
this.binaryFilesUploadedCount++;
410-
let progress = Math.floor(this.currentUploadProgress + this.binaryProgressOffset);
416+
let commits = [];
417+
let progress = this.currentUploadProgress;
418+
419+
for (let i = 1; i <= 10 && this.binaryFilesToUpload.length; i++) {
420+
progress = progress + this.binaryProgressOffset;
421+
this.binaryFilesUploadedCount++;
422+
let commit = this.binaryFilesToUpload.shift();
423+
commit.content = this.readFile(path.join(this.deployment.inputDir, commit.file_path.substr(7)));
424+
commits.push(commit);
425+
}
426+
411427
let operations = [this.binaryFilesUploadedCount, this.binaryFilesToUploadCount];
412-
let commit = this.binaryFilesToUpload.shift();
413-
commit.content = this.readFile(path.join(this.deployment.inputDir, commit.file_path.substr(7)));
414428
this.setUploadProgress(progress, operations);
415-
console.log('(!) BINARY FILE UPLOADED');
416-
this.makeCommit([commit], this.uploadBinaryFiles.bind(this), 'Publii - upload public/' + commit.file_path);
429+
console.log('(!) BINARY FILES UPLOADED');
430+
this.makeCommit(commits, this.uploadBinaryFiles.bind(this), '[skip ci] Publii - upload ' + commits.length + ' files');
417431
return;
418432
}
419433

@@ -453,7 +467,7 @@ class GitlabPages {
453467
}
454468

455469
console.log('(!) REMOTE FILES LIST UPDATED');
456-
return this.makeCommit(commit, this.mergeTemporaryBranch.bind(this), 'Publii - upload remote files list');
470+
return this.makeCommit(commit, this.mergeTemporaryBranch.bind(this), '[skip ci] Publii - upload remote files list');
457471
}
458472

459473
mergeTemporaryBranch () {

app/back-end/modules/deploy/s3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class S3 {
174174
}
175175

176176
let params = {
177-
ACL: "public-read",
177+
ACL: 'authenticated-read',
178178
Body: fileContent,
179179
Bucket: this.bucket,
180180
Key: fileName,

app/back-end/modules/render-html/contexts/feed.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ class RendererContextFeed extends RendererContext {
4242
let domainMediaPath = self.siteConfig.domain + '/media/posts/' + post[0] + '/';
4343
let preparedText = post[4].split('#DOMAIN_NAME#').join(domainMediaPath);
4444
let contentMode = self.siteConfig.advanced.feed.showFullText ? 'fullText' : 'excerpt';
45-
let text = preparedText.replace(/\<hr\s+id=["']{1}read-more["']{1}\s?\/?\>/gmi, '');
45+
let text = this.cleanUpText(preparedText);
4646
let excerpt = ContentHelper.prepareExcerpt(this.themeConfig.config.excerptLength, post[4]);
4747
let authorData = this.getAuthor('post', post[0]);
4848

49-
if(contentMode === 'fullText') {
50-
excerpt = false;
51-
} else {
49+
if(contentMode !== 'fullText') {
5250
text = false;
5351
}
5452

@@ -75,6 +73,15 @@ class RendererContextFeed extends RendererContext {
7573
});
7674
}
7775

76+
cleanUpText (text) {
77+
text = text.replace(/\<hr\s+id=["']{1}read-more["']{1}\s?\/?\>/gmi, '');
78+
text = text.replace(/contenteditable="false"/gmi, '');
79+
text = text.replace(/contenteditable="true"/gmi, '');
80+
text = text.replace(/data\-[a-z\-0-9]{1,}=".*?"/gmi, '');
81+
82+
return text;
83+
}
84+
7885
setContext() {
7986
this.loadData();
8087
this.prepareData();

app/back-end/modules/render-html/contexts/post.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class RendererContextPost extends RendererContext {
3030
this.hiddenPosts = this.hiddenPosts.map(post => this.renderer.cachedItems.posts[post[0]]);
3131
this.metaTitle = this.siteConfig.advanced.postMetaTitle;
3232
this.metaDescription = this.siteConfig.advanced.postMetaDescription;
33+
this.canonicalUrl = this.post.url;
3334
this.metaRobots = '';
3435

3536
if(this.metaData && this.metaData[0]) {
@@ -46,6 +47,10 @@ class RendererContextPost extends RendererContext {
4647
if(results.metaRobots) {
4748
this.metaRobots = results.metaRobots;
4849
}
50+
51+
if(results.canonicalUrl) {
52+
this.canonicalUrl = results.canonicalUrl;
53+
}
4954
}
5055

5156
// load related posts
@@ -279,6 +284,7 @@ class RendererContextPost extends RendererContext {
279284
metaTitleRaw: this.metaTitle,
280285
metaDescriptionRaw: this.metaDescription,
281286
metaRobotsRaw: metaRobotsValue,
287+
canonicalUrl: this.canonicalUrl,
282288
previousPost: this.previousPost,
283289
previousSimilarPost: this.previousSimilarPost,
284290
nextPost: this.nextPost,

app/back-end/modules/render-html/handlebars/helpers/canonical-link.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ function canonicalLinkHelper(rendererInstance, Handlebars) {
1111
Handlebars.registerHelper('canonicalLink', function (context) {
1212
let pageUrl = context.data.website.pageUrl;
1313

14+
// If current page is a post - check for canonical URL
15+
if (context.data.root.canonicalUrl) {
16+
pageUrl = context.data.root.canonicalUrl;
17+
}
18+
1419
// We need to remove amp directory from the url in AMP renderer mode
1520
if(rendererInstance.ampMode) {
1621
pageUrl = pageUrl.replace('/amp/', '/');

app/back-end/modules/render-html/handlebars/helpers/social-meta-tags.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,18 @@ function socialMetaTagsHelper(rendererInstance, Handlebars) {
4141

4242
if (contextData.data.context.indexOf('tag') !== -1) {
4343
title = contextData.data.root.tag.name;
44+
45+
if (rendererInstance.siteConfig.advanced.usePageTitleInsteadItemName) {
46+
title = contextData.data.root.title;
47+
}
4448
}
4549

4650
if (contextData.data.context.indexOf('author') !== -1) {
4751
title = contextData.data.root.author.name;
52+
53+
if (rendererInstance.siteConfig.advanced.usePageTitleInsteadItemName) {
54+
title = contextData.data.root.title;
55+
}
4856
}
4957
} else {
5058
// Data for the single post page
@@ -55,6 +63,11 @@ function socialMetaTagsHelper(rendererInstance, Handlebars) {
5563
}
5664

5765
title = contextData.data.root.post.title;
66+
67+
if (rendererInstance.siteConfig.advanced.usePageTitleInsteadItemName) {
68+
title = contextData.data.root.title;
69+
}
70+
5871
description = contextData.data.root.metaDescriptionRaw;
5972

6073
if(description === '') {
@@ -77,6 +90,12 @@ function socialMetaTagsHelper(rendererInstance, Handlebars) {
7790

7891
output += '<meta property="og:site_name" content="' + siteName.replace(/"/g, "'") + '" />';
7992
output += '<meta property="og:description" content="' + description.replace(/"/g, "'") + '" />';
93+
output += '<meta property="og:url" content="' + contextData.data.website.pageUrl + '" />';
94+
output += '<meta property="og:type" content="article" />';
95+
96+
if (rendererInstance.siteConfig.advanced.openGraphAppId !== '') {
97+
output += '<meta property="fb:app_id" content="' + rendererInstance.siteConfig.advanced.openGraphAppId + '" />';
98+
}
8099
}
81100

82101
// If user set Twitter username - generate Twitter Cards tags

app/back-end/modules/render-html/helpers/gdpr.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Gdpr {
33
let groups = ``;
44

55
for (let i = 0; i < configuration.groups.length; i++) {
6-
if (i === 0) {
6+
if (configuration.groups[i].id === '-' || configuration.groups[i].id === '') {
77
groups += `
88
<input
99
id="gdpr-necessary"
@@ -12,7 +12,7 @@ class Gdpr {
1212
disabled="disabled"
1313
type="checkbox">
1414
<label for="gdpr-necessary">
15-
${configuration.groups[0].name}
15+
${configuration.groups[i].name}
1616
</label>`;
1717
continue;
1818
}
@@ -29,8 +29,8 @@ class Gdpr {
2929

3030
let output = `
3131
<div class="cookie-popup js-cookie-popup ${configuration.behaviour !== 'badge' ? 'cookie-popup--uses-link' : ''} ${configuration.behaviour !== 'link' ? 'cookie-popup--uses-badge' : ''}">
32-
<h2>${configuration.popupTitlePrimary}</h2>
33-
32+
${configuration.popupTitlePrimary !== '' ? '<h2>' + configuration.popupTitlePrimary + '</h2>' : ''}
33+
3434
<p>
3535
${configuration.popupDesc}
3636
<a href="${Gdpr.getPrivacyPolicyUrl(configuration, renderer)}">
@@ -78,7 +78,7 @@ class Gdpr {
7878
transition: transform 0.8s ease 0s, -webkit-transform 0.8s ease 0s;
7979
will-change: transform;
8080
z-index: 1000;
81-
}
81+
}
8282
8383
.cookie-popup--uses-badge {
8484
background: #24a931;
@@ -124,13 +124,13 @@ class Gdpr {
124124
}
125125
126126
@media (max-width:600px) {
127-
.cookie-popup--uses-badge.cookie-popup--is-sticky {
127+
.cookie-popup--uses-badge.cookie-popup--is-sticky {
128128
bottom: 0 !important;
129129
left: 0;
130-
right: 0;
130+
right: 0;
131131
}
132132
}
133-
133+
134134
@media (min-width:600px) {
135135
.cookie-popup--uses-badge.cookie-popup--is-sticky:hover {
136136
bottom: 1rem;
@@ -300,27 +300,29 @@ class Gdpr {
300300
popup.classList.remove('cookie-popup--is-sticky');
301301
302302
setTimeout(function () {
303-
if (currentConfig) {
303+
if (currentConfig !== null) {
304304
window.location.reload();
305305
}
306306
}, 250);
307307
});
308308
309-
if (!currentConfig) {
309+
if (currentConfig === null) {
310310
popup.classList.add('cookie-popup--is-sticky');
311311
} else {
312-
var allowedGroups = currentConfig.split(',');
312+
if (currentConfig !== '') {
313+
var allowedGroups = currentConfig.split(',');
313314
314-
for (var i = 0; i < allowedGroups.length; i++) {
315-
var scripts = document.querySelectorAll('script[type="gdpr-blocker/' + allowedGroups[i] + '"]');
316-
var checkbox = popup.querySelector('input[type="checkbox"][name="gdpr-' + allowedGroups[i] + '"]');
315+
for (var i = 0; i < allowedGroups.length; i++) {
316+
var scripts = document.querySelectorAll('script[type="gdpr-blocker/' + allowedGroups[i] + '"]');
317+
var checkbox = popup.querySelector('input[type="checkbox"][name="gdpr-' + allowedGroups[i] + '"]');
317318
318-
if (checkbox) {
319-
checkbox.checked = true;
320-
}
319+
if (checkbox) {
320+
checkbox.checked = true;
321+
}
321322
322-
for (var j = 0; j < scripts.length; j++) {
323-
addScript(scripts[j].src, scripts[j].text);
323+
for (var j = 0; j < scripts.length; j++) {
324+
addScript(scripts[j].src, scripts[j].text);
325+
}
324326
}
325327
}
326328
}

app/config/AST.currentSite.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const AstCurrentSiteConfig = {
1919
sitemapAddAuthors: 1,
2020
sitemapAddHomepage: 1,
2121
sitemapExcludedFiles: '',
22+
usePageTitleInsteadItemName: false,
2223
openGraphEnabled: 1,
2324
openGraphImage: '',
25+
openGraphAppId: '',
2426
twitterCardsEnabled: 1,
2527
twitterCardsType: 'summary',
2628
twitterUsername: '',

app/default-files/default-themes/mercury/assets/css/main.css

Lines changed: 25 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)