• Welcome to Simple Machines Community Forum. Please login or sign up.
January 27, 2022, 03:09:22 AM

News:

Follow SMF on Twitter.


SMF Articles

Started by SMFHacks.com Team, September 04, 2008, 04:03:00 PM

Previous topic - Next topic

vbgamer45

Possible to do but you would need to modify the code of the articles system using $context['html_headers']
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Ataru Moroboshi

Quote from: vbgamer45 on June 16, 2015, 11:16:37 AM
Possible to do but you would need to modify the code of the articles system using $context['html_headers']

i added og metadata in index.template.php of my theme:


<title>', $context['page_title_html_safe'], '</title>';
// facebook and OG
if ($context['current_action'] != 'admin'){
if (isset($context['article']['title']))
echo '
<meta property="og:url" content="', $scripturl ,'/action,articles/sa,view/article,' , $context['article']['ID_ARTICLE'] , '.html" />';
elseif(empty($context['current_topic']))
echo '
<meta property="og:url" content="', $scripturl ,'" />';
else
echo '
<meta property="og:url" content="', $scripturl ,'?topic=',$context['current_topic'],'.0" />';
echo '
<meta property="og:type" content="article" />
<meta property="og:title" content="',$context['page_title_html_safe'], '" />
<meta property="og:description" content="' , !empty($context['meta_description']) ? $context['meta_description'] : $modSettings['meta_data_description_text'], '" />';
echo '
<meta property="og:image" content="http://www.mydomain.com/logofb.jpg" />';
echo '
<meta property="og:site_name" content="',$context['forum_name'],'" />
<meta property="fb:app_id" content="myapp_id" />';
} // facebook and OG



it's working good for topic pages, but not for smf articles. what's wrong?

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Ataru Moroboshi

$context['article'] is set, and  'property="og:url"' is correctly compiled in html page

but when i test page in https://developers.facebook.com/tools/debug/og/object/ it fetches home page instead of article page

can't figure why

vbgamer45

Because you have this set
echo '
         <meta property="og:image" content="http://www.mydomain.com/logofb.jpg" />';
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Ataru Moroboshi

It's an image that is shown when the link is shared with Facebook. Required in og guidelines for fb

Ataru Moroboshi

I opened a ticket in facebook help,

they say PHPSESSID is the problem:

QuoteHi David,

When our crawler accesses your page your server is injecting a PHPSESSID into the url and in turn you are displaying it in your og:url. This is what the crawler sees when it accesses your site.

<meta property="og:url" content="http://www.mydomain.com/index.php?PHPSESSID=44khamiod3qpj5sgr38pscvmv0&amp%3B%2Faction%2Carticles%2Fsa%2Cview%2Farticle%2C93.html" />

As this is the url that the crawler believes you want to be used as the canonical it redirects to that location and scrapes it. If you visit that url you will see that the og tags on that page match your index page.

To rectify this you will need to ensure that you are not using this url with PHPSESSID in your og:url.

Thanks,
Darren

any idea?

vbgamer45

No idea on session id but search the general smf support forums might be workarounds
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Ataru Moroboshi

ok, now i made it work using single quotes for og:url content, and phpsessid is not shown, but i have to use urls without quests and ecommercial and equals, if i put variables in querystrings (?action=articles;sa=view&article=92) it stops working, while using slashes and commas (index.php/action,article/sa,view/article,92.html) it works

now i need to change all urls in articles2.php and articles.template.php to  :o


Kindred

that would be because facebook is a decade behind the times in parsing valid URLs
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

SMFHacks.com Team

Update
3.0.2
!Delete invalid pictures when they fail to upload
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.

http://ForumRankings.net - Get Forum Ranked!
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

KarmicStigmata

I am using 3.0 of your Article system.  I had someone post an article last night to test it (un-modded) in any shape way or form and now every time someone goes to the article portion whatsoever.  It loops with an approve request for the article, we  had about 10 last night and 2 today.  He isn't even home.

vbgamer45

When trying to view the article?
Like what does it do?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

KarmicStigmata

I have no clue.  For some reason everytime you clicked on the Articles page, it would disapprove the article but the article was still live.  So it did it like 8 times, we just reinstalled and it was fine.

vbgamer45

Glad you have it working now
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

iain sherriff

Anyone know if there is a way to get Simple Thread Tags mod working with Articles ?
SMF 2.0.12

vbgamer45

I am not aware of any mods for that at this time.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

iain sherriff

SMF 2.0.12

Advertisement: