Show only headers in Octopress RSS - rss

I have a blog based on Octopress. It generates an RSS-feed, but that feed contains whole pages (posts) with images included.
How can I "shrink" it, so it would contain only headers of pages (posts)?
Octopress: 2.0
Jekyll: 2.0.3

In feed.xml, instead of using post.content, you can use post.excerpt.
Two solutions :
1 - Using octopress setup
Add a <!-- more --> in your posts to mark the limit between post.excerpt and post.content. content still contains both.
2 - Using Jekyll default
Remove this line excerpt_separator: <!--more--> from your config file. As the default excerpt separator is "\n\n" (two new lines) excerpt will be created autoamtically.
Alternative solution
Use the truncate filter {{ post.content | truncate: 200 | expand_urls: site.url | cdata_escape }}
You will find more information about excerpt in Jekyll documentation

Related

How do I add translation to custom templates in odoo 15

In odoo 15 I have created a custom layout template for an invoice report (PDF). This template contains some texts in German language. Where do I have to specify any translation of these texts so they are considered if the invoice is printed in e.g. English?
Activate debug mode.
You can find it in settings > translations > Transleted terms, and you search for your germans terms for translate them one by one.
You can set your template manually, settings > Technical > Email templates
and now you can edit the template. But this is a non-dynamic solution.
More dynamic way :
Use .po,.pot files in your custom modules. if you have computed strings in your template use the function "_" before.
Ex :
my_str = _("Hello, how are you")
afterwards, edit the '.po' file
Look at the documentation here:
https://www.odoo.com/documentation/16.0/developer/howtos/translations.html
Regards,

Control index.xml for Atom/RSS to generate valid rss feed (without relative links)

Task: I want to add an RSS feed to my site. (Later I want to add a separate RSS feed for a specific category [for R Bloggers])
Setup:
I use the Hugo Academic template
via the R blogdown package
push my sources to github
https://github.com/Tazinho/AlmostRandom
from where it gets published via netlify
http://www.malte-grosser.com/
added an example blogpost here
http://www.malte-grosser.com/post/test-post/
Issue and validation:
According to this video
https://www.youtube.com/watch?v=gF0tohv99Ow
my blogs rss should be this
http://www.malte-grosser.com/index.xml
According to some validator side
http://www.feedvalidator.org/
My rss feed seems not to be valid and has several kinds of errors
http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.malte-grosser.com%2Findex.xml
eg: line 5, column 11: link must be a full and valid URL: / [help]
Steps to solve this so far:
I followed some SO posts, as far as I could. For example this related one
Control index.xml for Atom/RSS (hugo / blogdown generates feed with relative links)
I added rss.xml to /post/layouts/ and modified it according to
https://coolbutuseless.bitbucket.io/2018/02/07/blogdown-rss-feed-of-full-articles/
I struggled a bit with the part under
"# Reference your RSS Feed". I don't know wehre exactly what exactly has to go
I read several other posts and tried to find similar public repositories from rbind.io.
I deleted most of my trials, to have a clean setup for further trials
the only parts I kept are the following changes within config.toml
baseurl = "http://malte-grosser.com/"
rssLimit = 10
[outputs]
home = [ "HTML", "CSS", "RSS" ]
section = [ "HTML", "RSS" ]
taxonomy = [ "HTML", "RSS" ]
taxonomyTerm = [ "HTML", "RSS" ]
and the rss.xml under /post/layouts/
From my understanding (after reading once more Control index.xml for Atom/RSS (hugo / blogdown generates feed with relative links)) it seems to be ok to have these kind of errors.
Also for anyone with similar problems: It turns out that the blogs RSS should be under http://www.malte-grosser.com/post/index.xml and the categories RSS's should be under http://www.malte-grosser.com/categories/R-bloggers/index.xml

Using Drupal 8: Changing blog hyperlink sentences

I'm currently using Drupal 8 blog module, however I want to change some of the English that is used.
For example, "View recent blog entries"
"USERNAME's blog"
Is it possible to change this?
Or do you know a module I can use to do this?
Many thanks,
Jake
SCREENSHOT
SOLVED:Solved
According to my understanding, There will be a blog module.Which was in the list of core modules before drupal-8 but now it has been removed.
Note: Do following changes in blog.module file (Expected Path in root director of drupal: /modules/blog/blog.module)
Search this line :
$internal_link = \Drupal::l(t('View recent blog entries'), $url);
Replace with this line :
$internal_link = \Drupal::l(t($account->getUsername().'\'s Blog'), $url);
If Unable to see changes then do clear all cache.
Output Snippet :

how to fetch old RSS feeds from movabletype site?

Is there any instructor for that? I mean some way to access other pages of movabletype feed?
Example:
MovableTypeSite/feed/page=10
or
MovableTypeSite/feed/rss?page=7
Assuming you are using the default static publishing scheme of Movable Type, your feeds are static files that cannot be modified through URL parameters. The feeds by default contain the last 15 entries, but you could increase this number by modifying the default "Feed - Recent Entries" template of the blog in question.
You could change <mt:Entries lastn="15"> to <mt:Entries lastn="60"> or <mt:Entries days="60"> or use any of the attributes of the Entries tag to customize your output.
It would also be possible to set up "paginated" feeds, such as a per month feed. You could start with the default feed index template referenced above and copy it into a new archive template of the type "Entry Listing".
A little-known feature of Movable Type's search is that it supports multiple templates and by default includes a feed template. In the search results URL, you can specify a page=2 argument (or whatever page). Of course, the trick is that you need a search term -- which may or may not work well for your use.
The URL: [MT Home]/mt-search.cgi?limit=20&Template=feed&search=test&page=2
Use in the template generating the feed (a number superior to the number of entries in the system), publish it, and voilà.

How to read website content in python

I am trying to write a program which reads articles (posts) of any website that could range from Blogspot or Wordpress blogs / any other website. As to write code which is compatible with almost all websites which might have been written in HTML5/XHTML etc.. I thought of using RSS/ Atom feeds as ground from extracting content.
However, as RSS/ Atom feeds usually might not contain entire articles of websites, I thought to gather all "posts" links from the feed using feedparser and then want to extract the article content from the respective URL.
I could get URL's of all articles in website (including summary. i.e., article content shown in feed) but I want to access the entire article data for which I have to use the respective URL.
I came across various libraries like BeautifulSoup, lxml etc.. (various HTML/XML Parsers) but I really don't know how to get the "exact" content of the article (I assume "exact" means the data with all hyperlinks, iframes, slides shows etc still exist; I don't want CSS part).
So, can anyone help me on it?
Fetching the HTML code of all linked pages is quite easy.
The hard part is to extract exactly the content you are looking for. If you simply need all code inside of the <body> tag, this shouldn't be a big problem either; extracting all text is equally simple. But if you want a more specific subset, you have more work to do.
I suggest that you download the requests and BeautifulSoup module (both avaible via easy_install requests/bs4 or better pip install requests/bs4). The requests module makes fetching your page really easy.
The following example fetches a rss feed and returns three lists:
linksoups is a list of the BeautifulSoup instances of each page linked from the feed
linktexts is a list of the visible text of each page linked from the feed
linkimageurls is a list of lists with the src-urls of all the images embedded in each page linked from the feed
e.g. [['/pageone/img1.jpg', '/pageone/img2.png'], ['/pagetwo/img1.gif', 'logo.bmp']]
import requests, bs4
# request the content of the feed an create a BeautifulSoup object from its content
response = requests.get('http://rss.slashdot.org/Slashdot/slashdot')
responsesoup = bs4.BeautifulSoup(response.text)
linksoups = []
linktexts = []
linkimageurls = []
# iterate over all <link>…</link> tags and fill three lists: one with the soups of the
# linked pages, one with all their visible text and one with the urls of all embedded
# images
for link in responsesoup.find_all('link'):
url = link.text
linkresponse = requests.get(url) # add support for relative urls with urlparse
soup = bs4.BeautifulSoup(linkresponse.text)
linksoups.append(soup)
linktexts.append(soup.find('body').text)
# Append all text between tags inside of the body tag to the second list
images = soup.find_all('img')
imageurls = []
# get the src attribute of each <img> tag and append it to imageurls
for image in images:
imageurls.append(image['src'])
linkimageurls.append(imageurls)
# now somehow merge the retrieved information.
That might be a rough starting point for your project.

Resources