Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from 1natsu172/fix/sharebutton-mixin
Browse files Browse the repository at this point in the history
fix/pageUrl pathSetting
  • Loading branch information
1natsu172 authored Oct 5, 2017
2 parents 2536b78 + a40a750 commit a508232
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build/src/pug/_inc/mixin/_meta.pug
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mixin metaList(pageSummaryObj)
meta(property="og:description", content= pageSummaryObj.description)
meta(property="og:type", content= pageSummaryObj.type)
meta(property="og:locale", content="ja_JP")
meta(property="og:url", content= siteSetting.rootUrl + pageSummaryObj.pageUrl)
meta(property="og:url", content= siteSetting.rootUrl + pathSetting.pageUrl())
meta(property="og:image", content= pageSummaryObj.ogImageUrl)
if siteSetting.fbAppID
meta(property="fb:app_id", content= siteSetting.fbAppID)
Expand Down
10 changes: 5 additions & 5 deletions build/src/pug/_inc/mixin/_shareButton.pug
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mixin shareButton(serviceName, type = 'official')
official:
`<a href="http://b.hatena.ne.jp/entry/" class="hatena-bookmark-button" data-hatena-bookmark-layout="basic-label-counter" data-hatena-bookmark-lang="ja" title="このエントリーをはてなブックマークに追加"><img src="https://b.st-hatena.com/images/entry-button/button-only@2x.png" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="https://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>`,
custom: {
href: `http://b.hatena.ne.jp/add?mode=confirm&amp;url=${ siteSetting.rootUrl + pageSummary.pageUrl }`,
href: `http://b.hatena.ne.jp/add?mode=confirm&amp;url=${ siteSetting.rootUrl + pathSetting.pageUrl() }`,
onclick: `window.open(this.href, 'HATEBUwindow', 'width=520, height=480, menubar=no, toolbar=no, scrollbars=yes'); return false;`,
target: "_blank",
rel: "noopener noreferrer"
Expand All @@ -18,7 +18,7 @@ mixin shareButton(serviceName, type = 'official')
<script src="https://d.line-scdn.net/r/web/social-plugin/js/thirdparty/loader.min.js" async="async" defer="defer"></script>
<script type="text/javascript">window.addEventListener("load", function() { LineIt.loadButton() });</script>`,
custom: {
href: 'https://timeline.line.me/social-plugin/share?url=' + encodeURIComponent(siteSetting.rootUrl + pageSummary.pageUrl),
href: 'https://timeline.line.me/social-plugin/share?url=' + encodeURIComponent(siteSetting.rootUrl + pathSetting.pageUrl()),
onclick: `window.open(this.href, 'LINEwindow', 'width=700, height=650, menubar=no, toolbar=no, scrollbars=yes'); return false;`,
target: "_blank",
rel: "noopener noreferrer"
Expand All @@ -31,7 +31,7 @@ mixin shareButton(serviceName, type = 'official')
custom: {
href: (function shareURL() {
const tweetParameter = {
url: 'url=' + encodeURIComponent(siteSetting.rootUrl + pageSummary.pageUrl) + '&',
url: 'url=' + encodeURIComponent(siteSetting.rootUrl + pathSetting.pageUrl()) + '&',
// via: 'via=' + encodeURIComponent(siteSetting.twitterUserName[0]) + '&',
related: 'related=' + encodeURIComponent(siteSetting.twitterUserName) + '&',
hashtag: 'hashtags=' + encodeURIComponent(siteSetting.hashtag) + '&',
Expand Down Expand Up @@ -61,9 +61,9 @@ mixin shareButton(serviceName, type = 'official')
js.src = "//connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v2.10";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-share-button" data-href="${ siteSetting.rootUrl + pageSummary.pageUrl }" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=${ encodeURIComponent(siteSetting.rootUrl + pageSummary.pageUrl) }&amp;src=sdkpreparse">シェア</a></div>`,
<div class="fb-share-button" data-href="${ siteSetting.rootUrl + pathSetting.pageUrl() }" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=${ encodeURIComponent(siteSetting.rootUrl + pathSetting.pageUrl()) }&amp;src=sdkpreparse">シェア</a></div>`,
custom: {
href: 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(siteSetting.rootUrl + pageSummary.pageUrl),
href: 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(siteSetting.rootUrl + pathSetting.pageUrl()),
onclick: `window.open(this.href, 'FBwindow', 'width=680, height=640, menubar=no, toolbar=no, scrollbars=yes'); return false;`,
target: "_blank",
rel: "noopener noreferrer"
Expand Down
2 changes: 1 addition & 1 deletion build/src/pug/_inc/modules/_head.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ html(lang= siteSetting.siteLang prefix="og: http://ogp.me/ns#")
block pageMeta
link(rel="icon" ,href= pathSetting.image + '/siteImage/favicon.ico')
link(rel="apple-touch-icon" ,href= pathSetting.image + '/siteImage/apple-touch-icon.png')
link(rel="canonical" ,href= siteSetting.rootUrl+pageSummary.pageUrl)
link(rel="canonical" ,href= siteSetting.rootUrl + pathSetting.pageUrl())
//- Load Compiled CSS
link(rel="stylesheet",href= pathSetting.css + '/style.css')
//- Load Compiled JS from moduleBundler
Expand Down
1 change: 1 addition & 0 deletions build/src/pug/_inc/settings/_pathSetting.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ include /_inc/settings/_projectNamePath.pug
},
css: _projectNamePath + '/assets/css', //- {string}
js: _projectNamePath + '/assets/js', //- {string}
pageUrl: () => { return _projectNamePath + pageSummary.pageUrl }, //- insert _projectNamePath in pageSummary.pageUrl
}

0 comments on commit a508232

Please sign in to comment.