Orchard CMS 1.8 Page Title not showing - title

It is my understanding that the default Core\Shapes\Views\Document.cshtml file has code to retrieve the page ("string title = Convert.ToString(Model.Title);") and site title below. However the value is blank even though titles have been entered into the CMS for each page. The "site title" gets displayed though.
Is this a bug? How can I retrieve the page's title to be included in the tag?
Thanks in advance!
.
.
.
string title = Convert.ToString(Model.Title);
string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);
.
.
.
<title>#Html.Title(title, siteName)</title>
#Display(Model.Head)

Related

HREF Class changing on every page

I am working to scrape the website:- "https://www.moglix.com/automotive/car-accessories/216110000?page=101" NOTE: 101 is the page number and this site has 783 pages.
I wrote this code to get all the URL's of the product mentioned on the page using beautifulsoup:-
prod_url = []
for i in range(1,400):
r = requests.get(f'https://www.moglix.com/automotive/car-accessories/216110000?page={i}')
soup = BeautifulSoup(r.content,'lxml')
for link in soup.find_all('a',{"class":"ng-tns-c100-0"}):
prod_url.append(link.get('href'))
There are 40 products on each page, and this should give me 16000 URLs for the products but I am getting 7600(approx)
After checking I can see that the class for a tag is changing on pages. For Eg:-
How to get this href for all the products on all the pages.
You can use find_all method and specified attrs to get all a tags also further filter it by using split and startswith method to get exact product link URL's
res=requests.get(f"https://www.moglix.com/automotive/car-accessories/216110000?page={i}")
soup=BeautifulSoup(res.text,"html.parser")
x=soup.find_all("a",attrs={"target":"_blank"})
lst=[i['href'] for i in x if (len(i['href'].split("/"))>2 and i['href'].startswith("/"))]
Output:
['/love4ride-steel-tubeless-tyre-puncture-repair-kit-tyre-air-inflator-with-gauge/mp/msnv5oo7vp8d56',
'/allextreme-exh4hl2-2-pcs-36w-9000lm-h4-led-headlight-bulb-conversion-kit/mp/msnekpqpm0zw52',
'/love4ride-2-pcs-35-inch-fog-angel-eye-drl-led-light-set-for-car/mp/msne5n8l6q1ykl',..........]

How can I get the link of all the posts in the Instagram profile with Selenium?

I'm trying to get the links of all the posts in an instagram profile.
How can I get to the href="/p/CX067tNhZ8i/" in the photo.
What I'm trying to do is find the href= blabla of all posts.
All your posts are in class="v1Nh3 kIKUG _bz0w".
I tried to get the hraf= blabla value from this class with the get_attribute command, but it didn't work.
Thank you for your help.
browser.get("https://www.instagram.com/lightning.mcqueen34/")
links = []
elements = browser.find_element_by_xpath('//*[#id="react-root"]/div/div/section/main/div/div[4]/article/div[1]/div/div[1]/div[3]')
for i in elements:
links.append(i.get_attribute('href'))
I thought this would work but the elements value is not a list . It gave an error.
This should work:elements = browser.find_elements_by_tag_name('a')
Below answer will not work in all cases, dependant on how the DOM of the page is loaded.
Replace this line:
elements = browser.find_element_by_xpath('//*[#id="react-root"]/div/div/section/main/div/div[4]/article/div[1]/div/div[1]/div[3]')
With:
elements = browser.find_element_by_xpath("//a[#href]")
This will let you retreive all links with a href from the page.
Try to change XPath first to get the DIV class or ID after trying this //a[#href] Xpath to get all HREF.

how to set meta tag dynamic from database in mvc

ViewData["ChildPageMetaConent"] = lstPageMetaContentChilds; // from this line i get data from database and set to ViewData .
Example : in ViewData["ChildPageMetaConent"] have list class. You can check in Image.
And on Master.cshtml I am accessing ViewData["ChildPageMetaConent"] variable and gointo to write on
page but its print on page like a text .
And on HTMl its look like this :
I got the Answer.
Need to Use #Html.Raw(string)
so it print exact html tag on page.

WebKitBrowser and Iframe - vb.net

At first , You need to know that this is my first question and i'm from Poland so very sory for any mistake.
I'm making program in VB.net.
I have site , not my , and there are Iframe. In the iframe is a text input. I need to change value of this input .
I make this in WebBrowser , but i need to make it in WebKitBrowser .
In WebBrowser this looks like:
WebBrowser1.Document.Window.Frames("NameOfFrame").Document.GetElementById("Text_Input").SetAttribute("value", "something")
In WebKitBrowser this don't work.
I'm trying this:
For Each oneelement As WebKit.DOM.Node In WebKitBrowser1.Document.GetElementById("NameOfFrame").ChildNodes
MsgBox(oneelement.NodeValue.ToString)
Next
One problem ..
I'm getting the msg:
"You need iframe support!"

iOS : How to implement a bookmark for ePub reader?

I'm create an ePub reader for iPad/iPhone
The basic code is from AePubReader
I add page curl effect,adjust image size ... but remove some function (ex.slider the page)
But I still don't know how to implement bookmark function ...
We have many discussion here , some people record the page number as bookmark index
This is a solution , but not good enough , if you wanna add mark in page 100 .
When you change the text size , you may not found the paragraph you want in p.100
So , as I say in the issue discuss , I need to do few things ...
1.Set < p > tag or id
2.Get the < p > in every page
3.Press the bookmark button means record the top < P > in current page ,if the the top < P > is from previous page , record the previous page's last < P >
4.Search the < P > by tag , if match , show the page number .
So ... I hope someone know the answer , Because Apple do not release any ePub reader
Thanks for any reply or answer .
Webber
This is might be one of solution ,when you load a part of epub , in typical situation ,one chapter could be just one html file .
We pagination the chapter in webView , so we got the the location of the html file we just reading , ex 35% part at the html .
so if we adjust the accuracy , like 0.2674 % at html location.
You can find where is the bookmark location ...
please vote the answer if you think this is right .
Here it is an approach which might work(not tested yet).
Store the chapter, the page index and the font . When you want to go to that bookmark you change the font twice ( first set the font stored and then the current font ) . The font changes are done while the webview is hidden . There might be a performance issue , although.