doc:tips:webshareapi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:tips:webshareapi [2022/07/09 15:52] – georgehall | doc:tips:webshareapi [2024/12/13 00:45] (current) – [Demo and Download by George] Is outdated/ Domain down fraenkiman | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Social media Sharing | + | ====== |
- | Published by george on Friday, July 8, 2022 | ||
- | webshare | + | Published by george on Friday, July 8, 2022, revised by [[https:// |
+ | |||
+ | [[https:// | ||
this works using android and apple phone and most tablets, Ubunto and windows desktops ,Also works using firefox, chrome,edge and opera browsers | this works using android and apple phone and most tablets, Ubunto and windows desktops ,Also works using firefox, chrome,edge and opera browsers | ||
- | first find and edit the file fp-interface/ | ||
- | {/static} | ||
- | paste the following code below it then save the file back to your server | ||
- | < | + | ==== How to integrate with Flatpress ==== |
+ | |||
+ | First find and edit the file [[https:// | ||
+ | '' | ||
+ | |||
+ | |||
+ | Paste the following code below it then save the file back to your server. | ||
+ | |||
+ | < | ||
<input type=" | <input type=" | ||
- | <script {literal}src=" | + | </code> |
- | < | + | Your new webshare API button will now show on each of your static pages. |
- | < | + | |
- | function shareTheLink () { | + | |
- | navigator.share({ | + | |
- | title: 'view this post', | + | |
- | text: 'I thought you might like this.', | + | |
- | url: location.href, | + | |
- | | + | |
- | fbId: '', | + | To add webshare API to all your posts your must edit the file [[https://github.com/ |
- | hashtags: [' | + | |
- | }, | + | |
- | { | + | |
- | | + | |
- | copy: true, | + | |
- | email: true, | + | |
- | print: true, | + | |
- | sms: true, | + | |
- | messenger: true, | + | |
- | facebook: true, | + | |
- | whatsapp: true, | + | |
- | twitter: true, | + | |
- | linkedin: true, | + | |
- | telegram: true, | + | |
- | skype: true, | + | |
- | language: 'en-gb' | + | |
- | }) | + | |
- | | + | |
- | .catch( error => console.log(' | + | |
- | }{/literal} | + | |
- | </script> | + | |
- | </div></code> | + | |
- | Your new webshare API button will now show on each of your static pages | + | |
- | To add webshare API to all your posts your must edit the file /fp-interface/themes/YOUR THEME/entry-default.tpl | + | Paste the following code above the last ''</ |
- | find the line | + | <code html> |
+ | <input type=" | ||
+ | </code> | ||
+ | Save the file and put it back on your server. | ||
- | {if ($categories)} Published by {$author} in {$categories|@filed}|{/if} {$comments|tag: | + | Edit the file [[https:// |
- | < | + | Add the following |
- | <script {literal}src=" | + | a. |
- | < | + | <code html> |
- | < | + | <script src="{$smarty.const.BLOG_BASEURL}webshare/ |
- | function shareTheLink () { | + | < |
- | navigator.share({ | + | function shareTheLink () { |
- | title: 'view this post', | + | navigator.share({ |
- | text: 'I thought you might like this.', | + | title: '{/ |
- | url: location.href, | + | text: 'I thought you might like this.', |
- | + | url: location.href, | |
+ | // extra, optional options | ||
+ | fbId: '', | ||
+ | hashtags: | ||
+ | },{ | ||
+ | // change this configurations to hide specific unnecessary functions | ||
+ | // Since your mobile device likely has native support for the Share API, it will be ignored and only applied to desktops. | ||
+ | copy: true, | ||
+ | email: true, | ||
+ | print: true, | ||
+ | sms: true, | ||
+ | messenger: | ||
+ | facebook: | ||
+ | whatsapp: | ||
+ | twitter: | ||
+ | linkedin: | ||
+ | telegram: | ||
+ | skype: true, // Turns off Skype SDK and 3rd party libraries | ||
+ | language: | ||
+ | }) | ||
+ | .then( _ => console.log(' | ||
+ | .catch( error => console.log(' | ||
+ | }{/ | ||
+ | </ | ||
+ | </ | ||
- | fbId: '', | ||
- | hashtags: [' | ||
- | }, | ||
- | { | ||
- | // change this configurations to hide specific unnecessary icons | ||
- | copy: true, | ||
- | email: true, | ||
- | print: true, | ||
- | sms: true, | ||
- | messenger: true, | ||
- | facebook: true, | ||
- | whatsapp: true, | ||
- | twitter: true, | ||
- | linkedin: true, | ||
- | telegram: true, | ||
- | skype: true, | ||
- | language: ' | ||
- | }) | ||
- | .then( _ => console.log(' | ||
- | .catch( error => console.log(' | ||
- | }{/literal} | ||
- | </ | ||
- | </ | ||
now all your posts will have a webshareAPI button | now all your posts will have a webshareAPI button | ||
- | if you prefer | + | |
- | test this on my website [[https://www.mypoppy.uk/blog|External Link]] just look for the webshare button below each post or page.If you are using a tablet or phone you may need to click on the more button when it opens | + | |
+ | |||
+ | ===== Language settings and adoption of Flatpress variables ===== | ||
+ | |||
+ | With a bit of manual work, the Webshare API adopts Flatpress' | ||
+ | |||
+ | |||
+ | ==== The file and directory structure ==== | ||
+ | |||
+ | < | ||
+ | www-root | ||
+ | │ | ||
+ | ├── fp-interface | ||
+ | │ | ||
+ | │ │ | ||
+ | │ │ | ||
+ | │ │ | ||
+ | │ │ : | ||
+ | │ │ | ||
+ | │ ├── sharedtpls | ||
+ | │ │ ├──────────── webshare_api.tpl | ||
+ | │ │ ├──────────── static_webshare_button.tpl | ||
+ | │ │ └──────────── entry_webshare_button.tpl | ||
+ | │ | ||
+ | │ | ||
+ | │ ├──────── entry-default.tpl // Part of the standard distro | ||
+ | │ └──────── static.tpl // Part of the standard distro | ||
+ | └── fp-plugins | ||
+ | └── webshare | ||
+ | ├── res | ||
+ | │ ├──────── share.js // Webshare-API | ||
+ | | ||
+ | ├──────────── Get-Facebook-App-ID.zip | ||
+ | └──────────── doc_webshare.txt // | ||
+ | </ |
doc/tips/webshareapi.1657374749.txt.gz · Last modified: 2022/07/09 15:52 by georgehall