Reserving space in html markup or adsense ads - html

Hey so this is really simple question, but for some reason I couldn't find an answer via google. I'm in the process of building a website (many things are still not functioning), but Im now adressing look and feel I would like have space reserved for adds in my php templates. Is it enough to just add a <div class='advertisement'> and use standard css to hold position?
(I know this will work for my purposes) Howver I am woundering if once google crawls my site in future will require less work to have add's displaying.
p.s. I have also readthrough google's guidlines on where add should be placed and hava a differnet look then rest of page Just woundering if I'm missing something.

If you use <div class='advertisement'></div> (with no content between the tags) and set the dimensions of the element in CSS, this is sufficient for reserving space, and Google sees it as empty (as it is) and ignores it, until you put some content there. There is no way, and no need, to inform Google about the future content of the page.
If you wish to insert some dummy content into the element, like “Advertize here” (which is really an ad of a kind) or “Reserved for ads”, that’s OK. It may help you during development and evaluation. Whether they are OK for real pages when launched needs to be considered carefully. But to search engines, that would be just content, and probably not relevant – it does not no much harm, but neither does it help. (We don’t expect people to search for such things, do we?)

#Mr.Alien comment is all I was really loking fir if google does not provide adds for testing... copy and pasted below
#brendanmorrison Keep sample banners with a text Advertise Here

Related

Who or what is injecting "data-contrast" spans into my website (at night) and how to stop it?

It has been brought to my attention that a website I'm helping out with sometimes has problems with span elements being injected. Those spans will break the whitespaces and make the text hard to read. Those spans look something like this:
<span data-contrast="auto">words</span>
<span data-contrast="auto">,</span>
<span data-contrast="auto">b</span>
<span data-contrast="auto">ut</span>
<span data-contrast="auto">sometimes also only single chars</span>
The website is run with/by WordPress, but that does not seem to be the cause because the affected posts look fine and show no sign of this markup in the post editor or database.
Also, those spans only seem to occur at nighttime. I tried to nail that down, but as so often, I couldn't really verify it yet, as it did not occur again to me, not even at night. Right now everything is fine and none of these spans are present.
I'm guessing it has got something to do with night-mode in browsers (although behaviour was the same in Edge and Firefox) or the night-mode in Windows but then on the other hand I haven't noticed this on any other page yet.
So, this is somewhat strange and hard to nail down, but you'll find copied texts that contain the same markup, when you use a search engine and search for "data-contrast span". So, at least I'm not the only one with this problem.
Any ideas how to nail this down and find out what causes it?
Browser plug-ins are usually given permission to modify page source at run time. I would guess the culprit is a cross-browser extension like Night Eye or Dark Reader.
In general, adding a <span> shouldn't mess with your layout unless your CSS is changing span properties away from the browser defaults.
Option 1
You might be able to fix the issue by adding CSS to control how the layout looks:
span[data-contrast="auto"] {...}
That will select all spans that have that data attribute. Then add styling to counteract the layout issues you see. That said, since the extension is adding the code after the page renders, it may override whatever you do.
Option 2
A better solution would be to create your own dark mode. Most plugins/OS night modes won't mess with your code if you provide your own theme options. A "dark" theme is the 2020 version of being mobile responsive; you should provide it in your code or live with the consequences when users, browser makers, and operating systems make their own decisions.
If you need help creating an alternate theme, CSS Tricks has a good write up.
Since it's not clear what software they are copying from, I've personally experienced this when copying from a Word Doc that's been opened in Microsoft Teams or in SharePoint, and then pasting directly into a website's editor (our site uses the TinyMCE text editor, a commonly utilized free text editor).
My recommendation: copy directly from the desktop version of Word, then paste into the editor and that prevents the "data-contrast" spans.
I assume there must be some hidden spans in non-desktop versions of Word Docs that they add to ensure the document displays the same way as the desktop version. The text editor doesn't know what to do with it, so it strips out everything, but the "data-contrast" portion.
Hope this helps someone out there as the original post was as asked some time ago.

mediawiki: have TOC / page sections displayed in the sidebar

one might assume that this would be quite a common question, but I couldn't find any helpful answers yet, so I'll ask. I have to add that I find the whole structure of mediawiki and also their help pages very confusing.
I'm not expecting an exact answer, I'll also be grateful for resources that will help me understand just how mediawiki is structured.
OK, so:
I want to set up a Wiki for personal uses, and I'm trying to get the sidebar customized to my needs, especially I want to have the section headings (that would be level 2 to, say, 4 headings) of the page that is currently viewed displayed in the sidebar (as anchors, I guess).
In other words, have the table of contents not on the top of the body / content part, but on the left hand side in the sidebar.
I have somewhat edited MediaWiki:Sidebar and could get rid of some stuff that I don't really need, but I just can't find a way to get a table of contents there.
Do I need an extension or is this possible with MWs standard functions?
I've seen this, but I would prefer not to edit the html or js myself and rather just edit MediaWiki:Sidebar if that is possible at all.
Thanks for any answers.
There isn't a build in way to do that. I don't know any extension, which actually provides such a feature. But there is a JavaScript, written by a MediaWiki developer, which does, I assume, what you're looking for:
https://github.com/prtksxna/persistent-toc
It will show all ToC levels at the left side, if the first visible area of the page goes out of the viewport (and the top ToC box isn't visible anymore). It would maybe not a big deal to limit the ToC to level 2-4. You could install this script via your MediaWiki:Common.js, your user specific js (like I did for WMF [projects][1] or you create a new extension, which adds the script and the css to your page.
[1]: https://meta.wikimedia.org/wiki/User:Florianschmidtwelzow/global.js projects

Collapsing Elements in a Google Doc With Google Apps Script - Is This Possible?

I'd love to be able to collapse and expand sections in my Google Docs document, making large documents easier to navigate. I was wondering if this is possible with Google Apps Script, or if I'd be wasting my time trying to find a way.
You cannot do anything special in Apps Script, just automate stuff that you can do manually.
So, there's no way to do real collapsing, since there's no such feature in Google Docs. But you can use available functionality in unorthodox ways and make it work for you. For example, you could save the content somewhere else (maybe another document), so you can remove and add "sections" making it look like collapsing. This would have the downside of polluting the document revision history a lot, since every collapse event will be treated as changes to the document. Or you could export the document as HTML, maybe host it on Drive itself and implement the collapsing there, using javascript, then just serve the link to the user.
Anyway, this is just a couple of ideas that recklessly throwing here, which may or may not work for you. But none of will ever be real collapsing on a Google Doc.
As an alternative, we used the outline feature, so we can jump up and down a document quickly:
First open the Outline tool from the menu: View -> Show document outline
If you want to reach a part of your document easily, select some text at that point and give it a heading: Hit the part of the toolbar that says "Normal Text" and change it to "Heading 5".
Remove any headings that you don't want from the Outline by hitting the X next to them.
Another "clue" that might be useable would be to actually "hide" or more precisely make almost invisible some parts of your document using something like the trick described in this other post.
The difficult thing will be to find the limits of the parts you would want to hide.... but it's worth giving it a try ;)

How can I create my web pages Read Only for peoples?

I have a website http://www.bccfalna.com/ and the contents on this site are in HINDI Language. I want to make all these pages read only for peoples so that they can not copy the content.
Since I have written some books in HINDI Language on Computer Technology and I know that there are very few Information in HINDI language on the Internet about the Computer and I.T. Technology so I want to sell my EBooks in PDF format.
To show the usefulness of the contents of my books, I have placed all the contents in TEXT format in my website, so that people can see, read and can make decision to buy the book if the book is useful for them.
Since I have placed my whole books in Content form on my site so that various search engines also can give more and more traffic to my site but I am afraid that since I have placed all my content on my site in text form, any one can copy and will not be interested to buy them as PDF Format EBOOK.
I want that people can Read the content of my site but can not be able to copy the contents in any word processor.
Is it possible?
I don't want to make image like content, because Google, Yahoo like modern search engines don't gives too much importance to image sites.
I don't want to use Flash like sites too. The reason is same. Modern Search Engines don't gives too much attention to these kinds of sites.
I want my contents in TEXT format but I want to make them READ ONLY. Is it possible? If Yes: I would like to know HOW? and if No, I would like to get the alternative type solution.
Is there someone Genius to solve this problem? Thanks.
Generally speaking, any web content that is readable by a search engine will also be readable and copyable by people visiting your page.
I suppose you could examine the user_agent in the HTTP request to determine whether it originated from a popular search engine or not; if it did, return the plain-text of your content; if it did not, return a raster image of your content (text in an image can't be selected for copying and pasting, but it could be OCR'd or otherwise printed by the user). Some websites will use a script to disable right-clicking to save an image (but such scripts can easily be circumvented). Some sites will place a transparent image over the image containing the content (but this, too, can be circumvented). Note that the user_agent can be falsified if the web surfer knows you're treating search engines specially.
I suggest the best approach, though, is to keep things simple. Only publish the first chapter of your book and a table of contents online, or else only publish the first page of each chapter, or something similar. Search engines do not need the complete text of your book, only representative samples. Nobody will go to the trouble of copy/pasting your text if they can only get to a portion of the complete book.
You can't make it indexable to search engines and incapable of being copy & pasted... Google has to be able to copy words from your text to use in it's index. Maybe you could put snippets of the parts you want indexed in text format and put the majority in image/flash. It's not uncommon to see chapter previews on websites selling books.
Try Google Books:
I don't know if it works with the HINDI Language (It works. Some examples: http://www.scribd.com/doc/15257971/Google-Hindi-Books)
This solution allows Google to index and everyone to read the whole content. Anyhow copying remains awkward.
http://books.google.com/googlebooks/tour/
"Read-only" means they cant modify your webpages, "readable but not copyable" is impossible by definition, and makes about as much sense as "I want to give someone some water, but I dont want it to be wet". So, to answer your question, no this is not possible at all. (I regularly have to deal with people who think that this (and others) law of physics/mathematics doesn't apply to them, so sorry if I sound a bit rude.)
On a practical level, if you only give them some of the information, then they will only be able to copy that part of the information. (If they buy the book, they will be able to copy the rest from there.)
As others here have said, what you are asking is not possible.
If you host content for people to view in a browser, and for Google to index, there is absolutely no way to stop anyone from copying it. It is possible to make copying the content difficult (or at least inconvenient), but there's no way to stop someone from copying it if that's what they really want to do.
The only alternative, as others have already said, is to only post the first chapter of the book, and allow your readers to make a judgement based on that chapter. If they like the chapter they'll buy the whole book. This is a pretty common practice.
I understand that posting only part of the content is not what you want, but if you want to make it impossible to copy the whole book then this is your only real option.
The other alternative is to not worry about it. Cory Doctorow (and others I'm sure) publishes all his books under a Creative Commons license. They are free to download from his website but he still manages to make money from selling actual books. If people like your work enough, they'll pay to have it in a nice format.
There is, a way to instruct the browser to disable copying text. This does not, however, prevent copying, just makes is difficult. Not all browsers recognize this, especially older browsers. However, there are ways around this, the user can download the entire page and search for the text embedded in the HTML.
Another way, is to make it a graphic, rather than ASCII text. That way would mean that if anyone really wanted to copy your content, they would have to go through the process of using OCR (optical character recognition), then proof read plus correct the result.
Another way is to make it into a Flash animation, that can also be bypassed by doing a screen capture, then doing an OCR. In short, there is no way to prevent copying of material displayed in a browser ... but you can make it difficult and, hopefully, people won't bother.
FYI, typically people want their website to be read-only, to make it difficult or impossible for hackers to change their website content (i.e. replace content with vandalized content) ... not to prevent people from accessing the content legitiamately uploaded to the website.
Hope this helps.
Scan the text and post as an image, people can still read but not copy the text directly. They can copy the image but that will not matter as it would be the same as just reading from the screen they would have to retype it all if they wanted to steal the work.

Embed section of HTML from another site?

Is there a way to embed only a section of a website in another HTML page?
Example: I see an answer I want to blog about, so I grab the HTML content, and splat it in somewhere, and show only that, styled like it is on stackoverflow. Basically, I want to blockquote the section of the page with original styling, if that makes sense. Is that something the site itself has to provide, or can I use an iframe and tell it to show only a certain element or something crazy? Open to all options, but I want it to show up as HTML, not as an image (that's really a last resort).
If this is even possible, are there security concerns I need to aware of?
Don't think image should really be last resort. You have no control over the HTML/CSS of the source page, so even if you craft a solution (probably by using JavaScript to parse out the desired snippet) there is no guarantee that tomorrow the site doesn't decide to change its layout.
Even Jeff, who has control over the layout of stackoverflow.com, still prefers to screen-capture the site, rather than pull in the contents live.
Now if your goal was to have the contents auto-update, that would be a different story. But still, unless you use some agreed-upon method of sharing content, such as RSS, your solution would be very fragile.
The concept you are describing is roughly what is called a "purple include" or "transclusions". There is a library out there for it, but its not exactly actively developed. Here's a couple ajaxian articles on it.
I'd recommend using a server side solution with Python; using urllib2 to request the page, then using BeautifulSoup to parse out the bit that you need. BeautifulSoup has a very flexible selection api with which you can craft heuristics for the section you are interested in.
To illustrate:
soup = BeautifulSoup(html)
text = soup.find(text="Some text on the page that is unlikely to change")
print soup.parent.prettify()
That way if the webmaster later changes the markup on the page, your scraping script should still work.
On client side <iframe> is the only practical option. It is possible to scroll it, but it might not work in the long term, because it's technically close to clickjacking attack.
There's also cross-site XHR, but requires opt-in from destination site, and today works only in few latest browsers.
Getting HTML on server side is easy (every decent web framework has ability to download page and parse HTML and you can use XPath/XSLT or DOM to extract bit you want).
Getting styles however is going to be tricky – CSS rules may not work with HTML fragment taken out of context. You'd have to parse CSS, extract and transform rules or use browser and read currentStyle of every node.
Obviously you have to heavily filter HTML you extract to avoid XSS. It's harder than it seems.
If you don't need to automate this, a good HTML+CSS WYSIWYG editor might be able to extract content fragment with styles.
That sounds like something that IE8's Web Slices would be perfect for. However, it's only available in IE8, and the site of origin would have to implement for you to be able to take advantage of it.