-
-
Notifications
You must be signed in to change notification settings - Fork 172
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
description content for optimised social sharing #184
Comments
@kgodey Mam, Please add labels to this issue so that somebody can take it. |
thanks for creating this @techievivek |
Can I work on this issue? |
@nik-gautam go ahead. |
@techievivek where can I find the latest code with the previous image fixes that you made? Thanks. |
@nik-gautam Check here #183 |
@kgodey Can't we use JavaScript here too to add meta description once the DOM content is loaded rather then going for plugins to strip HTML and get excerpt. |
@techievivek could you link the articles you read here? |
@techievivek I think will be easier to use javascript. A problem that I faced was where to get the info from, because as far I saw there is no common p-tag or any other tag that every page has (which contains the info we want to display), so a common script cannot be ran for all. Also, my mid-sem exams are going on right now, it will take me a few days to really start coding. Sorry for the delay. |
@kgodey Here is one they are doing using Jquery https://stackoverflow.com/questions/9231845/javascript-to-change-metadata-metatags-dynamically |
@nik-gautam All the post/page have content stored in content folder, we can use frontend html-stripping and get first 20 words to be part of meta description tag. |
@nik-gautam @kgodey It might not be possible with JS https://stackoverflow.com/questions/25420887/does-facebook-crawler-currently-interpret-javascript-before-parsing-the-dom |
@techievivek js won't work with Facebook crawler... I did some research, it turns out that fb gets the data by crawling and looking for og meta tags, before loading the DOM. So, any changes via JavaScript on DOM won't work. Data has to added before generating the static HTML files in lektor. |
@nik-gautam Yes, I tested it, it's not working. Try doing it with lektor plugins itself. |
@techievivek @kgodey I have somewhat fixed the issue. Can you check it before I make a PR? |
@kgodey @techievivek |
@nik-gautam It's good. If possible please add a screenshot so that it will easy to see the end result. @kgodey will be available after Tuesday till then you can look for other issues. |
Problem Description
Add the description content to be shown while sharing the link on Facebook and Twitter.
From the above image, you can see the description part is missing. Only the title and image are shown.
Solution Description
I have already added the image preview feature the only thing that is lacking is the description part that will be shown when any link will be shared.
Helping Hands
You can get the content part of a page/post and then first strip HTML tags to convert into plain text and then get the first 20 words or so to be used in the description part.
Some plugins that you can play with strip-html-tags and markdown-excerpt
Note
Please don't add new fields, use the one that are already implemented, read more about it here
The text was updated successfully, but these errors were encountered: